kmx / perl-Class-Throwable

0 stars 2 forks source link

Consider attaching an exception environmental context to a throwable #1

Open aramwram opened 6 years ago

aramwram commented 6 years ago

Hello, @kmx,

First, I'd like to acknowledge your module. I found it very useful in my project. Good job:)

Lately, I faced some issues which cannot be directly solved using Class::Throwable.

The use-case It might be handy if we allow Class::Throwable to remember some context in which it was called. For example at application level error messages might be used as templates with placeholders, e.g. "Mandatory argument is missing '{arg}'" where {arg} is a placeholder which can be filled with a concrete value when provided a specific context such as { arg => 'some_mandatory_arg' }.

The solution It depends on author's backward compatibility terms.

@kmx, please, let me know if you're interested in elaborating the above ideas. Please, also clarify your backward compatibility terms.

Aram, gmoyakomora@gmail.com

kmx commented 6 years ago

I am not using this module anymore (I am not even the original author).

I gave you commit/push permissions to this repo, feel free to update the module, I can release it to CPAN once you are happy with it.

aramwram commented 6 years ago

It's really kind of you. Thanks. Will do.

aramwram commented 6 years ago

I've realized that since Class::Throwable doesn't impose any restrictions on the types of input arguments to the method 'throw' it's possible to implement the above scenario right away without any changes. The only drawback is in the inconsistency between method names and their actual meaning.