Last active
November 27, 2018 16:30
-
-
Save Opalo/688fe7f715868b100b676d1c140c4ae9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class DomainExceptionWithErrors extends DomainException implements HasDomainErrors { | |
@Getter | |
private final MapBindingResult bindingResult; | |
DomainExceptionWithErrors(HttpStatus status, String reason) { | |
this(status, reason, null, null); | |
} | |
DomainExceptionWithErrors(HttpStatus status, String reason, String objectName) { | |
this(status, reason, objectName, null); | |
} | |
DomainExceptionWithErrors(HttpStatus status, String reason, String objectName, | |
Seq<DomainError> errors) { | |
super(status, reason); | |
this.bindingResult = new MapBindingResult(new HashMap<>(), objectName); | |
Option.of(errors).forEach(value -> value.forEach(this::addDomainError)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment