Catching an exception in app, that is thrown in service

Hi, currently working on a order system and we have a service for generating invoices for a given order. As we want to give the user a good experience we have implemented several “throw exception” situations in our service logic. But when these are triggered the only error message the user is left with (in the app) is that the entire service failed, not the custom messages that are thrown in the service.

We have an idea on how to bypass this by creating a sort of errormessage object, which is database connected and has a field for the error message. In this way we can extract the error message that is generated (added to the errormessage object in the service) and show it to our users in the app. We also looked at the event log mechanic, but dont feel like that is the optimal solution for this kind of problem.
If there is any simpler solutions, please let us know:)

2 Likes

Hi!

We believe this is a bug on the platform side, and we’re on it. Throw exception vs catch custom error is not working as expected.

Will keep you posted!

3 Likes

Hi, we are struggling with the same issue but towards external order systems. We need our API to specify the service response code. But our 409 throws a 400. We can build a custom response code to indicate the same, but then the service response with 200 OK which is misleading.

Seems like the excact same problem and it would be nice with some attention as its currently creating a lot of unnecessary noise.