Created
May 3, 2017 13:48
-
-
Save abdulbasitkay/31b3099e73483f4b004c4a33d12a939d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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