RADAR-base / RADAR-Appserver

General purpose application server for the radar platform currently with capability to schedule push notifications
10 stars 1 forks source link

Sending Response entities as exceptions. #457

Closed this-Aditya closed 2 months ago

this-Aditya commented 2 months ago

Updated Exception Handling mechanism, which involves sending ResponseEntities eg:

{ "timestamp": 1712402235.752647600, "status": 417, "message": "Invalid details supplied for the project ProjectDto(id=0, projectId=STAGING_PROJECT, createdAt=2023-04-06T13:31:32.897Z, updatedAt=2024-04-06T13:31:32.897Z)", "path": "uri=/projects", "cause": "'id' must not be supplied when creating a project as it is autogenerated." }

Right now which is:

{ "timestamp": 1712563716402, "status": 417, "error": "Expectation Failed", "path": "/projects" }

@yatharthranjan, @mpgxvii Please review this and let me know if you have any suggestions for improvement. Thanks

yatharthranjan commented 2 months ago

@mpgxvii how will the aRMT app be affected by this? Will we need to update the error catching code in the app?

mpgxvii commented 2 months ago

@mpgxvii how will the aRMT app be affected by this? Will we need to update the error catching code in the app?

Yes currently for all appserver errors, we just show a generic error message "Unable to connect to the appserver". I'll make the changes on the app side to show the appropriate error message.

this-Aditya commented 2 months ago

Thanks for the review!! Also updated handling of unhandled exceptions too.