Exception: CloudFS::RestAdapter::Errors::ServiceError

Inherits:
Error
  • Object
show all
Defined in:
lib/cloudfs/client/error.rb

Overview

Base class of all errors returned by cloudfs service

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, original = nil) ⇒ ServiceError

Returns a new instance of ServiceError.

Parameters:

  • message (String)

    error message

  • original (Exception) (defaults to: nil)

    original exception



218
219
220
221
# File 'lib/cloudfs/client/error.rb', line 218

def initialize(message, original=nil)
  super(message)
  @original = original
end

Instance Attribute Details

#codeFixnum (readonly)

Returns http status.

Returns:

  • (Fixnum)

    http status



245
246
247
248
249
250
251
# File 'lib/cloudfs/client/error.rb', line 245

def code
  if @original.respond_to?(:code)
    @original.code
  else
    -1
  end
end

#requestHash (readonly)

Returns request context.

Returns:

  • (Hash)

    request context



225
226
227
228
229
230
231
# File 'lib/cloudfs/client/error.rb', line 225

def request
  if @original.respond_to?(:request)
    @original.request
  else
    {}
  end
end

#responseHash (readonly)

Returns response context.

Returns:

  • (Hash)

    response context



235
236
237
238
239
240
241
# File 'lib/cloudfs/client/error.rb', line 235

def response
  if @original.respond_to?(:response)
    @original.response
  else
    {}
  end
end

Instance Method Details

#backtraceString

Returns backtrace of original exception.

Returns:

  • (String)

    backtrace of original exception



254
255
256
# File 'lib/cloudfs/client/error.rb', line 254

def backtrace
  @original.backtrace if @original && @original.respond_to?(:backtrace)
end