call method
Implementation
Future<http.Response> call(Object? error, StackTrace trace) async =>
switch (error) {
MethodNotAllowed() =>
await onMethodNotAllowed?.call(error) ?? Response.methodNotAllowed(),
UnmatchedTarget() =>
await onUnmatchedTarget?.call(error) ?? Response.badRequest(),
CollectionNotFound() => await onCollectionNotFound?.call(error) ??
Response.notFound(OutboundErrorDocument([
ErrorObject(
title: 'Collection Not Found',
detail: 'Type: ${error.type}',
)
])),
ResourceNotFound() => await onResourceNotFound?.call(error) ??
Response.notFound(OutboundErrorDocument([
ErrorObject(
title: 'Resource Not Found',
detail: 'Type: ${error.type}, id: ${error.id}',
)
])),
RelationshipNotFound() => await onRelationshipNotFound?.call(error) ??
Response.notFound(OutboundErrorDocument([
ErrorObject(
title: 'Relationship Not Found',
detail: 'Type: ${error.type}'
', id: ${error.id}'
', relationship: ${error.relationship}',
)
])),
UnsupportedMediaType() => Response.unsupportedMediaType(),
Unacceptable() => Response.unacceptable(),
_ => await onError?.call(error, trace) ??
Response(500,
document: OutboundErrorDocument(
[ErrorObject(title: 'Internal Server Error')]))
};