public class WellComposedErrorBody extends Object
Constructor and 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.
|
Modifier and Type | Method and 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() |
public WellComposedErrorBody(javax.ws.rs.core.Response.Status status, String message)
status
- the response status that caused this error.message
- the message to be displayed as the main cause of the error.public static void addExceptionFields(WellComposedErrorBody body, Throwable t)
body
- the object to add the throwable description to.t
- the throwable to read the description from.public void addErrorsField(String key, String value)
key
- key in the array where the value will be inserted.value
- value of the error that will be inserted.public javax.ws.rs.core.Response.Status getStatus()
public int getCode()
public String getMessage()
Copyright © 2005–2023 Pavlidis lab, Michael Smith Laboratories and Department of Psychiatry, University of British Columbia. All rights reserved.