Exception: BacklogKit::Error

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

Overview

Custom error class for rescuing from Backlog errors

Class Method Summary collapse

Class Method Details

.build_error_message(response, index) ⇒ String

Make a custom error message

Parameters:

  • response (Hash)

    Error response

  • index (Integer)

    Index of the error

Returns:

  • (String)

    Error message



11
12
13
14
15
16
17
# File 'lib/backlog_kit/error.rb', line 11

def self.build_error_message(response, index)
  message = "[ERROR #{index}] "
  message += "#{self.name.demodulize} - #{response['message']} (CODE: #{response['code']})"
  more_info = response['moreInfo'].to_s
  message += " (MORE INFO: #{more_info})" unless more_info.empty?
  message
end