posted 10 years ago
I am working on an application that requires me construct Error 404 and Error 500 manually. My application is client application --> Core --> Wrapper --> Adaptor --> database. All the communications between the Core and the Wrapper and between the Wrapper and Adapter use REST. And I am working on the Wrapper module.
When the Wrapper contacts the Adaptor to request for some data, if resource-not-found encountered, I am supposed to put 404 status code in the HTTP header and return it to the "core". All other exception internal to the Wrapper, I am supposed to put 500 status code in the HTTP header.
Would you guide me as to how to construct the code please?
For example, I think that I can do something like: ex.getCause(); But, how do I know it is resource-not-found so that I can construct the header and put 404 there? Thank you very much.