Module: Twirp

Defined in:
lib/twirp/error.rb,
lib/twirp/client.rb,
lib/twirp/service.rb,
lib/twirp/version.rb,
lib/twirp/encoding.rb,
lib/twirp/client_json.rb,
lib/twirp/client_resp.rb,
lib/twirp/service_dsl.rb

Overview

Copyright 2018 Twitch Interactive, Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the “License”). You may not use this file except in compliance with the License. A copy of the License is located at

http://www.apache.org/licenses/LICENSE-2.0

or in the “license” file accompanying this file. This file is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Defined Under Namespace

Modules: Encoding, ServiceDSL Classes: Client, ClientJSON, ClientResp, Error, Service

Constant Summary collapse

ERROR_CODES_TO_HTTP_STATUS =

Valid Twirp error codes and their mapping to related HTTP status. This can also be used to check if a code is valid (check if not nil).

{
  canceled:             408, # Request Timeout
  invalid_argument:     400, # Bad Request
  malformed:            400, # Bad Request
  deadline_exceeded:    408, # Request Timeout
  not_found:            404, # Not Found
  bad_route:            404, # Not Found
  already_exists:       409, # Conflict
  permission_denied:    403, # Forbidden
  unauthenticated:      401, # Unauthorized
  resource_exhausted:   429, # Too Many Requests
  failed_precondition:  412, # Precondition Failed
  aborted:              409, # Conflict
  out_of_range:         400, # Bad Request

  internal:             500, # Internal Server Error
  unknown:              500, # Internal Server Error
  unimplemented:        501, # Not Implemented
  unavailable:          503, # Service Unavailable
  data_loss:            500, # Internal Server Error
}
ERROR_CODES =

List of all valid error codes in Twirp

ERROR_CODES_TO_HTTP_STATUS.keys
VERSION =
'1.13.1'