Is it possible to extend Failure
with option trace
?
def Failure(value = Undefined, trace: RightBiased::Left.trace_caller, &block)
v = Undefined.default(value, block || Unit)
Failure.new(v, trace)
end
Here is what I want to do.
I’m creating a gem for coding standard(style) with dry-monads, and use it in my project with my team members. The problem is when unexpected error occurs (for example: syntax error), the failure always trace back to my gem’s base class, not the place where it really appeared. This situation occurs because I try to catch standard error and pass it to Failure
. So I want to customize trace string in Failure constructor.
If the idea is accepted, I can open a PR in the repo.