Sha256: 51bd408a9174ea94954a49c3fb3299345676bbdb5719f675dde9b77eaaf83086

Contents?: true

Size: 505 Bytes

Versions: 2

Compression:

Stored size: 505 Bytes

Contents

# frozen_string_literal: true

module Alma::Error
  def has_error?
    !error.empty?
  end

  def error_message
    (has_error?) ? error["errorList"]["error"]["errorMessage"] : ""
  end

  def error
    @response.fetch("web_service_result", {})
  end
end

module Alma
  class StandardError < ::StandardError
    def initialize(message, loggable = {})
      if Alma.configuration.enable_loggable
        message = { error: message }.merge(loggable).to_json
      end

      super message
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alma-0.3.3 lib/alma/error.rb
alma-0.3.2 lib/alma/error.rb