Domain error template
(, de)
In case you plan to use Validations, it can be handy to
have a DomainError
class that can serve as parent for more specific errors.
package org.bargsten.common;
import lombok.Getter;
@Getter
public class DomainError {
protected String message;
protected Throwable exception;
public RuntimeException toException() {
return new RuntimeException(message, exception);
}
}