FailureReportStore class
Persists failure reports to a JSON file on disk.
Used by FailureReportQueue to survive app restarts:
- On flush failure → save un-exported reports to disk
- On next startup → load persisted reports and re-attempt flush
- On successful flush → clear the file
Storage Format
Reports are stored as a JSON array of maps. Each failure is serialized with its runtime type and message, so OTel spans can be reconstructed with full context even after deserialization.
[
{
"failureType": "ServerFailure",
"message": "Internal server error",
"timestamp": "2024-01-15T10:30:00.000Z",
"stackTrace": "#0 ...",
"attributes": {"usecase": "GetProductUseCase"},
"failureData": {"statusCode": 500}
}
]
Constructors
- FailureReportStore({required String filePath})
Properties
- filePath → String
-
Path to the persistence file.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasPersisted → bool
-
Whether there are persisted reports on disk.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → Future< void> - Delete the persistence file.
-
load(
) → Future< List< FailureReport> > - Load persisted reports from disk.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
save(
List< FailureReport> reports) → Future<void> - Save reports to disk. Overwrites any existing file.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited