Sha256: ef71c4c2e755931ab5d4c245c599072b0000705d1282a06315c722cc54249242

Contents?: true

Size: 973 Bytes

Versions: 2

Compression:

Stored size: 973 Bytes

Contents

# Copyright © 2014, Evercam.

module Evercam
   # This is the base error class for exceptions generated within the Evercam
   # library.
   class EvercamError < StandardError
      # Constructor for the EvercamError class.
      #
      # ==== Parameters
      # message::   A String containing the error message for the exception.
      # code::      The error code associated with the exception if one is
      #             available. Defaults to nil.
      # status::    The HTTP status code associated with the exception if one
      #             is available. Defaults to nil.
      # *context::  A collection of contextual data associated with the
      #             exception.
      def initialize(message, code=nil, status=nil, *context)
         super(message)
         @code    = code
         @status  = status
         @context = context
      end

      attr_reader :status, :context

      def code
         (@code || "unknown_error")
      end
   end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
evercam-0.1.2 lib/evercam/exceptions.rb
evercam-0.1.1 lib/evercam/exceptions.rb