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:
34 35 36 37 38 |
# File 'lib/gcloud/bigquery/errors.rb', line 34 def initialize , code, errors = [] #:nodoc: super @code = code @errors = errors end |
Instance Attribute Details
#code ⇒ Object (readonly)
The code of the error.
28 29 30 |
# File 'lib/gcloud/bigquery/errors.rb', line 28 def code @code end |
#errors ⇒ Object (readonly)
The errors encountered.
32 33 34 |
# File 'lib/gcloud/bigquery/errors.rb', line 32 def errors @errors end |
Class Method Details
.from_response(resp) ⇒ Object
:nodoc:
40 41 42 43 44 45 46 |
# File 'lib/gcloud/bigquery/errors.rb', line 40 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:
48 49 50 |
# File 'lib/gcloud/bigquery/errors.rb', line 48 def self.from_response_data error #:nodoc: new error["message"], error["code"], error["errors"] end |
.from_response_status(resp) ⇒ Object
:nodoc:
52 53 54 55 56 57 58 59 |
# File 'lib/gcloud/bigquery/errors.rb', line 52 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 |