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) {
    case PARSE_ERROR:
      return 'parse error';
    case INVALID_REQUEST:
      return 'invalid request';
    case METHOD_NOT_FOUND:
      return 'method not found';
    case INVALID_PARAMS:
      return 'invalid parameters';
    case INTERNAL_ERROR:
      return 'internal error';
    default:
      return null;
  }
}