implemented basic search function with Homebox provider
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
package com.vaessl.app.exception;
|
||||
|
||||
public class ConnectionNotFoundException extends RuntimeException {
|
||||
}
|
||||
@@ -11,7 +11,12 @@ public enum ErrorMessage {
|
||||
HttpStatus.SERVICE_UNAVAILABLE,
|
||||
"The target URL is unreachable."), SERVER_ERROR_GENERAL(
|
||||
"The external app returned a server error: "), WRONG_SERVICE_TYPE(
|
||||
HttpStatus.NOT_FOUND, "No such service type.");
|
||||
HttpStatus.NOT_FOUND,
|
||||
"No such service type."), CONNECTION_NOT_FOUND(
|
||||
HttpStatus.NOT_FOUND,
|
||||
"No active connection found for this service."), REMOTE_API_EMPTY_RESPONSE(
|
||||
HttpStatus.BAD_GATEWAY,
|
||||
"Remote API returned empty response for ");
|
||||
|
||||
private final HttpStatus status;
|
||||
private final String message;
|
||||
|
||||
@@ -59,6 +59,11 @@ public class GlobalExceptionHandler {
|
||||
BAD_REQUEST_EMPTY_FIELDS.getMessage() + " " + e.getMissingFields());
|
||||
}
|
||||
|
||||
@ExceptionHandler(ConnectionNotFoundException.class)
|
||||
public ProblemDetail handleConnectionNotFound(ConnectionNotFoundException e) {
|
||||
return ProblemDetail.forStatusAndDetail(CONNECTION_NOT_FOUND.getStatus(), CONNECTION_NOT_FOUND.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(RemoteApiException.class)
|
||||
public ProblemDetail handleRemoteApiException(RemoteApiException e) {
|
||||
return ProblemDetail.forStatusAndDetail(REMOTE_API_EMPTY_RESPONSE.getStatus(),
|
||||
|
||||
Reference in New Issue
Block a user