Exception: MisarBlog::ApiError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/misarblog/errors.rb

Overview

Raised when the Misar.Blog dev-API returns a non-2xx response.

Direct Known Subclasses

NetworkError, PlanLimitError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, message, error_type = "api_error", body = nil) ⇒ ApiError

Returns a new instance of ApiError.



6
7
8
9
10
11
# File 'lib/misarblog/errors.rb', line 6

def initialize(status, message, error_type = "api_error", body = nil)
  @status = status
  @error_type = error_type
  @body = body
  super("misar-blog: API error #{status} (#{error_type}): #{message}")
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



4
5
6
# File 'lib/misarblog/errors.rb', line 4

def body
  @body
end

#error_typeObject (readonly)

Returns the value of attribute error_type.



4
5
6
# File 'lib/misarblog/errors.rb', line 4

def error_type
  @error_type
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/misarblog/errors.rb', line 4

def status
  @status
end