-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
120 additions
and
10 deletions.
There are no files selected for viewing
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
104 changes: 104 additions & 0 deletions
104
src/main/java/io/sinistral/proteus/server/exceptions/ServerException.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/** | ||
* | ||
*/ | ||
package io.sinistral.proteus.server.exceptions; | ||
|
||
import javax.ws.rs.core.Response.Status; | ||
|
||
/** | ||
* @author jbauer | ||
* | ||
*/ | ||
public class ServerException extends Exception | ||
{ | ||
/** | ||
* | ||
*/ | ||
private static final long serialVersionUID = 8360356916374374408L; | ||
|
||
private Integer status = 500; | ||
|
||
|
||
|
||
public ServerException(int status) | ||
{ | ||
super(); | ||
this.status = status; | ||
} | ||
|
||
|
||
public ServerException(String message, Throwable cause, int status) | ||
{ | ||
super(message, cause); | ||
this.status = status; | ||
} | ||
|
||
/** | ||
* @param message | ||
*/ | ||
public ServerException(String message, int status) | ||
{ | ||
super(message); | ||
this.status = status; | ||
} | ||
|
||
|
||
/** | ||
* @param cause | ||
*/ | ||
public ServerException(Throwable cause, int status) | ||
{ | ||
super(cause); | ||
this.status = status; | ||
} | ||
|
||
public ServerException(Status status) | ||
{ | ||
super(); | ||
this.status = status.getStatusCode(); | ||
} | ||
|
||
|
||
public ServerException(String message, Throwable cause, Status status) | ||
{ | ||
super(message, cause); | ||
this.status = status.getStatusCode(); | ||
} | ||
|
||
/** | ||
* @param message | ||
*/ | ||
public ServerException(String message, Status status) | ||
{ | ||
super(message); | ||
this.status = status.getStatusCode(); | ||
} | ||
|
||
|
||
/** | ||
* @param cause | ||
*/ | ||
public ServerException(Throwable cause, Status status) | ||
{ | ||
super(cause); | ||
this.status = status.getStatusCode(); | ||
} | ||
|
||
/** | ||
* @return the status | ||
*/ | ||
public Integer getStatus() | ||
{ | ||
return status; | ||
} | ||
|
||
/** | ||
* @param status the status to set | ||
*/ | ||
public void setStatus(Integer status) | ||
{ | ||
this.status = status; | ||
} | ||
|
||
|
||
} |