module SlackMsgr::ErrorHandling

Handles all chat functionality and methods corresponding with Slack API

Public Class Methods

configuration_error(_opts) click to toggle source
# File lib/utils/error_handling.rb, line 21
def configuration_error(_opts)
  {
    exception: ConfigurationError,
    message: "Error with configruation: access_tokens not found\n" \
      'At least one oauth token must be configured using access_tokens'
  }
end
raise(error_type, opts = {}) click to toggle source
# File lib/utils/error_handling.rb, line 7
def raise(error_type, opts = {})
  err = send(error_type, opts)

  Kernel.raise err[:exception], err[:message]
end
req_args_missing(opts) click to toggle source
# File lib/utils/error_handling.rb, line 29
def req_args_missing(opts)
  {
    exception: ArgumentError,
    message: "Required arguments missing: Method #{opts[:method]} requires arguments:\n" \
      "[ #{opts[:req_args].join(', ')} ] Refer to https://api.slack.com/methods/"
  }
end
unknown_method(opts) click to toggle source
# File lib/utils/error_handling.rb, line 13
def unknown_method(opts)
  {
    exception: NoMethodError,
    message: "Method not found: #{opts[:method] || 'unknown_method'} does not exist\n" \
      "If you would like this method added, please add an issue at #{GITHUB_REPO}"
  }
end