Sha256: c345b64b1244e3208fc4a830aa3d44792d3a8775f0fb530a4f90fc21fc6cd9b1
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true class BCDD::Result::Error < StandardError def self.build(**_kargs) new end class NotImplemented < self end class MissingTypeArgument < self def initialize(_arg = nil) super('A type (argument) is required to invoke the #on/#on_type method') end end class UnexpectedOutcome < self def self.build(outcome:, origin:) message = "Unexpected outcome: #{outcome.inspect}. The #{origin} must return this object wrapped by " \ 'BCDD::Result::Success or BCDD::Result::Failure' new(message) end end class WrongResultSubject < self def self.build(given_result:, expected_subject:) message = "You cannot call #and_then and return a result that does not belong to the subject!\n" \ "Expected subject: #{expected_subject.inspect}\n" \ "Given subject: #{given_result.send(:subject).inspect}\n" \ "Given result: #{given_result.inspect}" new(message) end end class WrongSubjectMethodArity < self def self.build(subject:, method:) new("#{subject.class}##{method.name} has unsupported arity (#{method.arity}). Expected 0 or 1.") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bcdd-result-0.4.0 | lib/bcdd/result/error.rb |