-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MODINVOICE-514] - Uninformative error in invoice payment due to user…
…not linked to the Purchase Order's acquisition unit (#457) [MODINVOICE-514] - Uninformative error in invoice payment due to user not linked to the Purchase Order's acquisition unit
- Loading branch information
1 parent
52138c7
commit 047bdb9
Showing
4 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.folio.utils; | ||
|
||
import org.folio.invoices.rest.exceptions.HttpException; | ||
import org.folio.invoices.utils.ErrorCodes; | ||
|
||
public final class ExceptionUtil { | ||
|
||
private ExceptionUtil() { | ||
} | ||
|
||
public static boolean matches(Throwable cause, ErrorCodes errorCode) { | ||
if (cause instanceof HttpException httpException) { | ||
var errors = httpException.getErrors(); | ||
return errors != null && errors.getErrors() != null && errors.getErrors() | ||
.stream() | ||
.anyMatch(error -> errorCode.getCode().equals(error.getCode())); | ||
} | ||
return false; | ||
} | ||
|
||
} |
This file contains 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