View Issue Details

IDProjectCategoryView StatusLast Update
0023714mantisbtapi restpublic2018-02-06 21:17
Reportervboctor Assigned Tovboctor  
Status closedResolutionfixed 
Product Version2.9.0 
Target Version2.11.0Fixed in Version2.11.0 
Summary0023714: Failing REST API requests should include Mantis error code and localized message

Currently we return an http error code and English message from code. We should return a json that includes Mantis error code (as in constants file), exception message and localized message for display to user.

TagsNo tags attached.




2017-12-09 02:14

manager   ~0058368

The following PR handles the thrown MantisException's and returns code, message, and localized message. For APIs that still use the return values, it will show only the message. The http status will include the http status code + the message. The information about the mantis error code and its parameters is missing in this case, it will show up as we convert more APIs to throw.


Related Changesets

MantisBT: master c0747fc8

2017-12-09 00:41:46


Details Diff
Improve REST API error handling

- Specific route handlers don’t need to catch exceptions just to return them in the response.
- In case of errors include a json with Mantis error code, message, and localized message for thrown exceptions.
- Convert RestFault and throw, though in this case only include the message in json, no code or localized message.

LegacyApiFaultException can be removed once all APIs throw proper exceptions instead of returning RestFault.

Fixes 0023714
Affected Issues
mod - api/rest/index.php Diff File
mod - api/rest/restcore/issues_rest.php Diff File
mod - api/soap/mantisconnect.php Diff File
mod - api/soap/mc_api.php Diff File
mod - api/soap/mc_core.php Diff File
mod - core/error_api.php Diff File
add - core/exceptions/LegacyApiFaultException.php Diff File