Trace: • REST Exception Handling
This is an old revision of the document!
Our standard REST services come with standard exception handling. This means that all server-side exceptions will send the http status code 400 (Bad Request) to the client. The implementation already checks some exception types and returns custom http status codes:
Exception | http status |
---|---|
UnknownObjectException | 404 (Not found) |
SecurityException | 403 (Forbidden) |
InvalidPasswordException | 401 (Unauthorized) |
If you want custom status codes, it's possible to throw RestServiceException. This Exception class supports custom status codes and error messages.