Sha256: b1719640039318a5135945ab6d9c3eeebdc8a69377397b0063f1172cef53ae80

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

module Masks
  module Error
    # Base class for Masks errors
    class Base < RuntimeError
    end

    # Thrown when a session is required but not provided
    class InvalidSession < Base
      def initialize
        super("a session was expected, but none was provided")
      end
    end

    # Thrown when invalid configuration is detected
    class InvalidConfiguration < Base
      def initialize(value)
        super("cannot use '#{value}' for masks.json")
      end
    end

    # Thrown when configuration is not found
    class ConfigurationNotFound < Base
      def initialize
        super("cannot find masks.json")
      end
    end

    # Thrown when Masks encounters an unauthorized session
    class Unauthorized < Base
      def initialize
        super("unauthorized")
      end
    end

    # Thrown when Masks cannot find a mask for a session
    class UnknownMask < Base
      def initialize(session)
        super("could not determine mask for #{session}")
      end
    end

    # Thrown when Masks cannot find an access class for the given name
    class UnknownAccess < Base
      def initialize(name)
        super("could not determine access class for #{name}")
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
masks-0.4.0 app/models/masks/error.rb
masks-0.3.2 app/models/masks/error.rb
masks-0.3.1 app/models/masks/error.rb
masks-0.3.0 app/models/masks/error.rb
masks-0.2.0 app/models/masks/error.rb