Sha256: 5d1316ba1d5a5c05264c49404475c76a9db6ebad2d1edabab13548b31b7e4081

Contents?: true

Size: 828 Bytes

Versions: 3

Compression:

Stored size: 828 Bytes

Contents

module Goliath
  module Validation
    # A information about exceptions raised during validation.
    class Error < StandardError
      # The status code to return from the error handler
      attr_accessor :status_code
      # The headers to return from the error handler
      attr_accessor :headers

      # Create a new Goliath::Validation::Error.
      #
      # @example
      #  raise Goliath::Validation::Error.new(401, "Invalid credentials")
      #
      # @param status_code [Integer] The status code to return
      # @param message [String] The error message to return
      # @return [Goliath::Validation::Error] The Goliath::Validation::Error
      def initialize(status_code, message, headers = {})
        super(message)
        @status_code = status_code
        @headers = headers
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
goliath-1.0.7 lib/goliath/validation/error.rb
goliath-1.0.6 lib/goliath/validation/error.rb
goliath-1.0.5 lib/goliath/validation/error.rb