isErrorDocument function

bool isErrorDocument(
  1. Map<String, dynamic> doc
)

Whether the JSON document doc is an error response — its type is a trust-task-error Type URI — rather than a success response.

Keys off the type, as isErrorResponse does, never the payload's shape.

Implementation

bool isErrorDocument(Map<String, dynamic> doc) {
  final type = doc['type'];
  return type is String && bareTypeUri(type).contains('/trust-task-error/');
}