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.



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

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.



26
27
28
# File 'lib/web_function.rb', line 26

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.



26
27
28
# File 'lib/web_function.rb', line 26

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



38
39
40
41
42
# File 'lib/web_function.rb', line 38

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