Sha256: c4dd0628a2ed1a1cb5b94dad85a92240b7ade9474a10daee6e2e42591f90c29a
Contents?: true
Size: 1.65 KB
Versions: 5
Compression:
Stored size: 1.65 KB
Contents
# frozen_string_literal: true module Micro class Case module Error class UnexpectedResult < TypeError MESSAGE = '#call! must return an instance of Micro::Case::Result'.freeze def initialize(klass); super(klass.name + MESSAGE); end end class ResultIsAlreadyDefined < ArgumentError def initialize; super('result is already defined'.freeze); end end class InvalidResultType < TypeError def initialize; super('type must be a Symbol'.freeze); end end class InvalidResultInstance < ArgumentError def initialize; super('argument must be an instance of Micro::Case::Result'.freeze); end end class InvalidUseCase < TypeError def initialize; super('use case must be a kind or an instance of Micro::Case'.freeze); end end class InvalidUseCases < ArgumentError def initialize; super('argument must be a collection of `Micro::Case` classes'.freeze); end end class InvalidInvocationOfTheThenMethod < StandardError def initialize; super('Invalid invocation of the Micro::Case::Result#then method'); end end class UndefinedFlow < ArgumentError def initialize; super("This class hasn't declared its flow. Please, use the `flow()` macro to define one.".freeze); end end class InvalidAccessToTheUseCaseObject < StandardError def initialize; super('only a failure result can access its use case object'.freeze); end end module ByWrongUsage def self.check(exception) exception.is_a?(Error::UnexpectedResult) || exception.is_a?(ArgumentError) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
u-case-2.6.0 | lib/micro/case/error.rb |
u-case-2.5.0 | lib/micro/case/error.rb |
u-case-2.4.0 | lib/micro/case/error.rb |
u-case-2.3.1 | lib/micro/case/error.rb |
u-case-2.3.0 | lib/micro/case/error.rb |