public interface Errors extends Iterable<Error>
Records errors happening in the application.
To prevent OOME when errors are frequent, it is possible to limit the amount of recorded errors with the `werval.errors.max` configuration property. This default to 100.
Errors is an Iterable<Error>. Implementations are required to provide predictible and sorted iteration starting with the last error and ending with the oldest recorded error.
Modifier and Type | Method and Description |
---|---|
List<Error> |
asList()
Get a list of all Errors.
|
void |
clear()
Clear recorded errors.
|
int |
count() |
Optional<Error> |
get(String errorId)
Get an Error by its identity.
|
Optional<Error> |
last()
Get last recorded Error.
|
Optional<Error> |
lastOfRequest(String requestIdentity)
Get last recorder error pertaining to a given request.
|
List<Error> |
ofRequest(String requestId)
Get a List<Error> containing only Errors pertaining to a given request.
|
Error |
record(String requestId, String message, Throwable cause)
Record a new Error.
|
forEach, iterator, spliterator
Error record(String requestId, String message, Throwable cause)
requestId
- Request identitity
message
- Error message
cause
- Cause
int count()
void clear()
Optional<Error> get(String errorId)
errorId
- Error identity
List<Error> ofRequest(String requestId)
requestId
- Request identity