Exception: WebFunction::Error Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A base error class for WebFunction. All errors inherit from this class.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, code: self.class.error_code, details: nil) ⇒ Error

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Error.



30
31
32
33
34
# File 'lib/web_function.rb', line 30

def initialize(message = nil, code: self.class.error_code, details: nil)
  super(message)
  @code = code
  @details = details
end

Instance Attribute Details

#codeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



28
29
30
# File 'lib/web_function.rb', line 28

def code
  @code
end

#detailsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



28
29
30
# File 'lib/web_function.rb', line 28

def details
  @details
end

Class Method Details

.error_codeString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the error code for the error. Used as default error code if no code is provided.

Returns:

  • (String)

    The error code



40
41
42
43
44
# File 'lib/web_function.rb', line 40

def self.error_code
  name.sub(/^WebFunction::/, "WFN_")
      .gsub(/([a-z\d])([A-Z])/, '\1_\2')
      .upcase
end