mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-02-01 07:39:35 +01:00
Legger til en klasse som representerer en nettverksfeilmelding
This commit is contained in:
parent
e559048f07
commit
2835a253fa
@ -0,0 +1,43 @@
|
|||||||
|
package inf112.fiasko.roborally.networking;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class represents a response saying that something went wrong with the request
|
||||||
|
*/
|
||||||
|
public class ErrorResponse {
|
||||||
|
private String errorMessage;
|
||||||
|
private Exception thrownException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new error response
|
||||||
|
* @param errorMessage The error message describing the error
|
||||||
|
*/
|
||||||
|
public ErrorResponse(String errorMessage) {
|
||||||
|
this.errorMessage = errorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new error response
|
||||||
|
* @param errorMessage The error message describing the error
|
||||||
|
* @param thrownException The exception to throw
|
||||||
|
*/
|
||||||
|
public ErrorResponse(String errorMessage, Exception thrownException) {
|
||||||
|
this.errorMessage = errorMessage;
|
||||||
|
this.thrownException = thrownException;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the error message attached to the error response
|
||||||
|
* @return An error message
|
||||||
|
*/
|
||||||
|
public String getErrorMessage() {
|
||||||
|
return this.errorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the exception attached to the error response
|
||||||
|
* @return An exception or null
|
||||||
|
*/
|
||||||
|
public Exception getThrownException() {
|
||||||
|
return this.thrownException;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user