snag
snag copied to clipboard
Consider a replace error function
Hello! Long-time enjoyer of the package here. I often end up writing this in my pipelines:
dict.get(..)
|> result.replace_error(snag.new("reason"))
This works, but over time it has gotten tedious. I would much prefer a more straightforward call, like:
dict.get(..)
|> snag.replace_error("reason")
I end up writing this a lot, as all my functions return Snags, but many library functions return Result(.., Nil)
What do you think of adding a function like this?
Sounds great to me!! Want to make a PR?
Fantastic! I'll open a PR tomorrow for it!