Exception: Gcloud::Bigquery::ApiError
- Defined in:
- lib/gcloud/bigquery/errors.rb
Overview
Raised when an API call is not successful.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
The code of the error.
-
#errors ⇒ Object
readonly
The errors encountered.
Class Method Summary collapse
-
.from_response(resp) ⇒ Object
:nodoc:.
-
.from_response_data(error) ⇒ Object
:nodoc:.
-
.from_response_status(resp) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#initialize(message, code, errors = []) ⇒ ApiError
constructor
:nodoc:.
Constructor Details
#initialize(message, code, errors = []) ⇒ ApiError
:nodoc:
36 37 38 39 40 |
# File 'lib/gcloud/bigquery/errors.rb', line 36 def initialize , code, errors = [] #:nodoc: super @code = code @errors = errors end |
Instance Attribute Details
#code ⇒ Object (readonly)
The code of the error.
30 31 32 |
# File 'lib/gcloud/bigquery/errors.rb', line 30 def code @code end |
#errors ⇒ Object (readonly)
The errors encountered.
34 35 36 |
# File 'lib/gcloud/bigquery/errors.rb', line 34 def errors @errors end |
Class Method Details
.from_response(resp) ⇒ Object
:nodoc:
42 43 44 45 46 47 48 |
# File 'lib/gcloud/bigquery/errors.rb', line 42 def self.from_response resp #:nodoc: if resp.data? && resp.data["error"] from_response_data resp.data["error"] else from_response_status resp end end |
.from_response_data(error) ⇒ Object
:nodoc:
50 51 52 |
# File 'lib/gcloud/bigquery/errors.rb', line 50 def self.from_response_data error #:nodoc: new error["message"], error["code"], error["errors"] end |
.from_response_status(resp) ⇒ Object
:nodoc:
54 55 56 57 58 59 60 61 |
# File 'lib/gcloud/bigquery/errors.rb', line 54 def self.from_response_status resp #:nodoc: if resp.status == 404 new "#{resp.}: #{resp.request.uri.request_uri}", resp.status else new resp., resp.status end end |