View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0021661||mantisbt||code cleanup||public||2016-09-03 20:40||2018-03-05 10:44|
|Priority||normal||Severity||minor||Reproducibility||have not tried|
|Summary||0021661: throw errors as exceptions|
Error handling is currently done with PHP error triggering, which is handled in error_api.
For example: In bug-action-group, if any operation in the list of bugs fails, the whole task is stopped. By using try-catch, any error for an individual bug operation can be managed and shown to the user at the ending report.
A proposal is to set up an error handling mode that throws exception instead of showing the current error page. This mode can be switched on and off, when exception-aware code is going to be used.
|Tags||No tags attached.|
@cproensa, you might be interested in having a look at a branch which has been removed some while ago.
I see there is doing a full refactor to exception handling.
@atrol see this proof of concept, applied to bug_actiongroup
I'm on board with moving towards exceptions. I would appreciate a solution that achieves the following:
I suggest a slow refactor where we have classes for our entities that does the ORM + exceptions. Then have the existing APIs provide the same behavior over such classes until they are no longer needed.
We can then use these model classes as the foundation for our SOAP/REST API as well as our regular web page calls.
Examples of such gradual refactoring including introduction of classes like MantisEnum, though it doesn't involve DB access.
vboctor, that is a very long term goal, at current progression.
Have a look at my proposal, which is a more short term idea:
(This exception class could be improved in the future as the parent of specific exceptions. But that is another story, as you suggested.)
Think of it like the facility we currently have for error handling that bypasses ui and outputs HTTP error header.
I see direct application:
Adding here something related
EDIT: fix markdown
|2016-09-03 20:40||cproensa||New Issue|
|2016-09-04 09:15||atrol||Note Added: 0053933|
|2016-09-04 13:14||cproensa||Note Added: 0053936|
|2016-09-05 02:52||vboctor||Note Added: 0053937|
|2016-09-05 14:24||cproensa||Note Added: 0053950|
|2017-08-29 23:54||vboctor||Relationship added||related to 0021595|
|2018-03-05 10:40||fman||Note Added: 0059088|
|2018-03-05 10:44||dregad||Note Edited: 0059088||View Revisions|