Skip to content

Instantly share code, notes, and snippets.

@Raouf25
Last active April 24, 2020 16:51
Show Gist options
  • Save Raouf25/3dcf0a2987c8e7418952beb1850f8157 to your computer and use it in GitHub Desktop.
Save Raouf25/3dcf0a2987c8e7418952beb1850f8157 to your computer and use it in GitHub Desktop.
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import java.util.Arrays;
import java.util.List;
@Getter
@Setter
@Slf4j
public class BackendException extends Exception {
private static final String MESSAGE = "{}: {}";
private final ErrorEnum code;
private final List<String> additionalInfo;
public BackendException(ErrorEnum code, String message, Object... parameter) {
super(code.name());
this.code = code;
this.additionalInfo = Arrays.asList(String.format(message, parameter));
log.error(MESSAGE, code, additionalInfo, this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment