Sha256: 1a4addde817eac49d3eb5ae0286ee360d60851dad8000c49c22926a1e68455d7

Contents?: true

Size: 904 Bytes

Versions: 10

Compression:

Stored size: 904 Bytes

Contents

module Rescue
  class ApplicationError < StandardError

    STATUS_CODES = {
      40  => { http: 400, status: 'Invalid Request'     },
      49  => { http: 400, status: 'Unsupported'         },
      81  => { http: 401, status: 'Access Denied'       },
      83  => { http: 401, status: 'Expired Token'       },
      98  => { http: 403, status: 'Not Permitted'       },
      99  => { http: 403, status: 'Suspended Account'   },
      121 => { http: 410, status: 'Deleted Resources'   },
      140 => { http: 429, status: 'Rate Limit Exceeded' },
      210 => { http: 500, status: 'Internal Error'      },
      230 => { http: 503, status: 'Over Capacity'       },
    }

    attr_accessor :code
    attr_accessor :stauts

    def initialize code, status, message = nil
      @code    = code
      @status  = (message ? status : STATUS_CODES[code][:status])
      @message = message
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rescue-dog-0.3.9 lib/rescue/exceptions/application_error.rb
rescue-dog-0.3.8 lib/rescue/exceptions/application_error.rb
rescue-dog-0.3.7 lib/rescue/exceptions/application_error.rb
rescue-dog-0.3.5 lib/rescue/exceptions/application_error.rb
rescue-dog-0.3.4 lib/rescue/exceptions/application_error.rb
rescue-dog-0.3.2 lib/rescue/exceptions/application_error.rb
rescue-dog-0.3.1 lib/rescue/exceptions/application_error.rb
rescue-dog-0.3.0 lib/rescue/exceptions/application_error.rb
rescue-dog-0.2.1 lib/rescue/exceptions/application_error.rb
rescue-dog-0.2.0 lib/rescue/exceptions/application_error.rb