#76 Set a message for error responses
Without one, clients might treat errors as generic failures instead of handling them in a manner appropriate for their error code
This commit is contained in:
@@ -23,5 +23,6 @@ package io.kamax.mxisd.exception;
|
|||||||
public class InvalidParamException extends RuntimeException {
|
public class InvalidParamException extends RuntimeException {
|
||||||
|
|
||||||
public InvalidParamException() {
|
public InvalidParamException() {
|
||||||
|
super("The chosen hash algorithm is invalid or disallowed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,5 +23,6 @@ package io.kamax.mxisd.exception;
|
|||||||
public class InvalidPepperException extends RuntimeException {
|
public class InvalidPepperException extends RuntimeException {
|
||||||
|
|
||||||
public InvalidPepperException() {
|
public InvalidPepperException() {
|
||||||
|
super("The provided pepper is invalid or expired");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -189,7 +189,7 @@ public abstract class BasicHttpHandler implements HttpHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void respond(HttpServerExchange ex, int status, String errCode, String error) {
|
protected void respond(HttpServerExchange ex, int status, String errCode, String error) {
|
||||||
respond(ex, status, buildErrorBody(ex, errCode, error));
|
respond(ex, status, buildErrorBody(ex, errCode, error != null ? error : "An error has occurred"));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleException(HttpServerExchange exchange, HttpMatrixException ex) {
|
protected void handleException(HttpServerExchange exchange, HttpMatrixException ex) {
|
||||||
|
Reference in New Issue
Block a user