name function

String? name(
  1. int errorCode
)

Returns a human-readable name for errorCode if it's one specified by the JSON-RPC 2.0 spec.

If errorCode isn't defined in the JSON-RPC 2.0 spec, returns null.

Implementation

String? name(int errorCode) => switch (errorCode) {
      PARSE_ERROR => 'parse error',
      INVALID_REQUEST => 'invalid request',
      METHOD_NOT_FOUND => 'method not found',
      INVALID_PARAMS => 'invalid parameters',
      INTERNAL_ERROR => 'internal error',
      _ => null
    };