Open ThorbenLindhauer opened 4 years ago
This comment was imported from JIRA and written by user @mboskamp
Hi LaY5wB0,
could you please explain what your use case is and how an interceptor for errors in the rest API would help you?
Cheers, Miklas
This comment was imported from JIRA and written by user LaY5wB0What is this name?
This pseudonym name was generated based on the user name in JIRA to protect the personal data of our JIRA users. You can use this identifier to search for issues by the same reporter.
Hi @Miklas,
Consider a example such as a User Task submission: There may be server side validations that occur (as can occur with Generated Forms, but also just in general). When those validations occur and a exception is thrown (because the validation did not pass), the response that is returned to the rest api is a type
and a message
.
type: "ProcessEngineException
message: "Process Engine Exception 123453: You Validation Failed blah blah blah"
But in many cases it is advantageous to return additional properties along with the normal error so the client side can provide more information/structured information (such as additional json objects with field specific validation errors).
Consider another scenario where you submit a Message, and if that message is sent through the rest api, you may want to return a specific response that is not a Process Engine Exception, and has a different status code with different content:
Example: you build a plugin that captures the message and if it does not correlates successfully you route that message into a "buffer" or as a timerEntity job for future execution/retry of the correlation. The plugin would not know if it is a rest api or just an internal command: the plugin can just throw the generic exception: "Message was Buffered" and define the additional contexts (status code, additional props, etc). When the rest api picks up this exception it would handle it differently than the currently hardcoded exceptions, and use the status code.
This comment was imported from JIRA and written by user @mboskamp
Thanks LaY5wB0 for this request. I understood your use-case and it makes sense. I will forward this to product management.
This issue was imported from JIRA:
What is this name?
This pseudonym name was generated based on the user name in JIRA to protect the personal data of our JIRA users. You can use this identifier to search for issues by the same reporter.often when working with the process engine and specialized engine plugins, a developer would like to control the engine's response for error handling / anything other than the REST APIs response. It would be great if there was a Exception in the process engine that takes a message, object (to be serialized by object mapper) and a status code. So if the exception is picked up by the Camunda Rest API, it allows the developer to control what exception is returned in the json response.
Links: