renamed enum classes

This commit is contained in:
2026-04-06 01:28:31 +02:00
parent be0821b0be
commit 8b1a604dc2
3 changed files with 31 additions and 20 deletions
@@ -2,25 +2,34 @@ package com.vaessl.app.exception;
import org.springframework.http.HttpStatus;
import lombok.Getter;
import com.fasterxml.jackson.annotation.JsonValue;
@Getter
public enum ErrorMessages {
public enum ErrorMessage {
BAD_REQUEST_EMPTY_FIELDS(HttpStatus.BAD_REQUEST, "Fields must not be empty."), UNAUTHORIZED_WRONG_LOGIN(
HttpStatus.UNAUTHORIZED, "Invalid username or password."), SERVICE_UNAVAILABLE_UNREACHABLE_URL(
HttpStatus.SERVICE_UNAVAILABLE, "The target URL is unreachable."), SERVER_ERROR_GENERAL(
"The external app returned a server error: ");
"The external app returned a server error: "), WRONG_SERVICE_TYPE(HttpStatus.BAD_REQUEST,
"No such service type.");
private final HttpStatus status;
private final String message;
ErrorMessages(HttpStatus status, String message) {
private ErrorMessage(HttpStatus status, String message) {
this.status = status;
this.message = message;
}
ErrorMessages(String message) {
private ErrorMessage(String message) {
this.status = null;
this.message = message;
}
public HttpStatus getStatus() {
return status;
}
@JsonValue
public String getMessage() {
return message;
}
}