Skip to content

Instantly share code, notes, and snippets.

@abdulbasitkay
Created May 3, 2017 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abdulbasitkay/31b3099e73483f4b004c4a33d12a939d to your computer and use it in GitHub Desktop.
Save abdulbasitkay/31b3099e73483f4b004c4a33d12a939d to your computer and use it in GitHub Desktop.
public class ApiException extends RuntimeException {
private static final long serialVersionUID = 1L;
/**
* contains redundantly the HTTP status of the response sent back to the
* client in case of error, so that the developer does
* not have to look into the response headers.
*/
private int status;
private String developerMessage; //detailed error description for developers
public ApiException() {
}
public ApiException(int status, String message, String developerMessage) {
super(message);
this.status = status;
this.developerMessage = developerMessage;
}
public ApiException(String message) {
//...
}
public ApiException(String message, String developerMessage) {
super(message);
this.developerMessage = developerMessage;
this.status = BAD_REQUEST.getStatusCode();
}
// getters & setters
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment