class Dry::Types::CoercionError
Base class for coercion errors raise by dry-types
Attributes
meta[R]
Metadata associated with the error
@return [Object]
Public Class Methods
handle(exception, meta: Undefined) { || ... }
click to toggle source
@api private
# File lib/dry/types/errors.rb, line 17 def self.handle(exception, meta: Undefined) if block_given? yield else raise new( exception.message, meta: meta, backtrace: exception.backtrace ) end end
new(message, meta: Undefined, backtrace: Undefined)
click to toggle source
@api private
Calls superclass method
# File lib/dry/types/errors.rb, line 35 def initialize(message, meta: Undefined, backtrace: Undefined) unless message.is_a?(::String) raise ::ArgumentError, "message must be a string, #{message.class} given" end super(message) @meta = Undefined.default(meta, nil) set_backtrace(backtrace) unless Undefined.equal?(backtrace) end