Package ubic.gemma.rest.util
Class WellComposedErrorBody
- java.lang.Object
-
- ubic.gemma.rest.util.WellComposedErrorBody
-
public class WellComposedErrorBody extends Object
Object acting as a payload for the ResponseErrorObject.- Author:
- tesarst
-
-
Constructor Summary
Constructors Constructor Description WellComposedErrorBody(javax.ws.rs.core.Response.Status status, String message)
Creates a new well composed error body that can be used as a payload for a GemmaApiException, or ResponseErrorObject.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addErrorsField(String key, String value)
Adds a new field into the errors array property.static void
addExceptionFields(WellComposedErrorBody body, Throwable t)
Adds descriptive values from the throwable object to the instance of WellComposedErrorBody.int
getCode()
Used by JSON Serializer.Map<String,String>
getErrors()
Used by JSON Serializer.String
getMessage()
Used by JSON Serializer.javax.ws.rs.core.Response.Status
getStatus()
-
-
-
Constructor Detail
-
WellComposedErrorBody
public WellComposedErrorBody(javax.ws.rs.core.Response.Status status, String message)
Creates a new well composed error body that can be used as a payload for a GemmaApiException, or ResponseErrorObject.- Parameters:
status
- the response status that caused this error.message
- the message to be displayed as the main cause of the error.
-
-
Method Detail
-
addExceptionFields
public static void addExceptionFields(WellComposedErrorBody body, Throwable t)
Adds descriptive values from the throwable object to the instance of WellComposedErrorBody.- Parameters:
body
- the object to add the throwable description to.t
- the throwable to read the description from.
-
addErrorsField
public void addErrorsField(String key, String value)
Adds a new field into the errors array property.- Parameters:
key
- key in the array where the value will be inserted.value
- value of the error that will be inserted.
-
getStatus
public javax.ws.rs.core.Response.Status getStatus()
- Returns:
- the Response Status of this error body.
-
getCode
public int getCode()
Used by JSON Serializer.- Returns:
- the code of the Response Status of this error body.
-
getMessage
public String getMessage()
Used by JSON Serializer.- Returns:
- the message of this error body.
-
-