Sha256: d370b224d74f95cf5f8ac828b1f65238268c48c93ad3f4d20916673bf0d54ad5

Contents?: true

Size: 1.98 KB

Versions: 45

Compression:

Stored size: 1.98 KB

Contents

module Inferno
  module Exceptions
    class TestResultException < RuntimeError
    end

    class AssertionException < TestResultException
      def result
        'fail'
      end
    end

    class SkipException < TestResultException
      def result
        'skip'
      end
    end

    class OmitException < TestResultException
      def result
        'omit'
      end
    end

    class PassException < TestResultException
      def result
        'pass'
      end
    end

    class WaitException < TestResultException
      def result
        'wait'
      end
    end

    class CancelException < TestResultException
      def result
        'cancel'
      end
    end

    class ParentNotLoadedException < RuntimeError
      def initialize(klass, id)
        super("No #{klass.name.demodulize} found with id '#{id}'")
      end
    end

    class ValidatorNotFoundException < RuntimeError
      def initialize(validator_name)
        super("No '#{validator_name}' validator found")
      end
    end

    class RequiredInputsNotFound < RuntimeError
      def initialize(missing_inputs)
        super("Missing the following required inputs: #{missing_inputs.join(', ')}")
      end
    end

    class NotUserRunnableException < RuntimeError
      def initialize
        super('The chosen runnable must be run as part of a group')
      end
    end

    class UnknownAttributeException < RuntimeError
      def initialize(attributes, klass)
        attributes_string = attributes.map { |attribute| "'#{attribute}'" }.join(', ')
        super("Unknown attributes for #{klass.name}: #{attributes_string}")
      end
    end

    class UnknownSessionDataType < RuntimeError
      def initialize(output)
        super("Unknown type '#{output[:type]}' for '#{output[:name]}'.")
      end
    end

    class BadSessionDataType < RuntimeError
      def initialize(name, expected_class, actual_class)
        super("Expected '#{name}' to be a #{expected_class.name}, but found a #{actual_class.name}.")
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
inferno_core-0.1.2.pre lib/inferno/exceptions.rb
inferno_core-0.1.1 lib/inferno/exceptions.rb
inferno_core-0.1.1.pre lib/inferno/exceptions.rb
inferno_core-0.1.0 lib/inferno/exceptions.rb
inferno_core-0.1.0.pre lib/inferno/exceptions.rb