hoaproject / Core

The Hoa\Core library.

Home Page:https://hoa-project.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Be able to toggle activation of Exception Handler.

stephpy opened this issue · comments

hi,

Point 1: At this moment, all libraries has dependency on hoaproject/core, itself has a exception handler which can have some conflicts with other exception handlers (symfony|(other fwk, i never tested) ...

Imagine user install any hoa library on his fwk, he may not want to install a new exception handler ...

Point 2: If you're agree with that, should it be activated by default ? Should this exception handler be enabled on a full stack version of hoa ? (sohoa)

Thought ?

Hello :-),

Yup, we should do that. We have a lot of possible ways to achieve that. Better ones I have in minds are: either a constant (that will act as a macro) or a static method in the core.

I have another question: does Symfony allow to disable its own exception and error handlers?

Thanks :-).

I don't know, but the exception/error handlers is only activated on symfony/debug (used in symfony/symfony), you can use all other libraries without having a new exception/error handler system.

So, there is two “issues”: (i) toggle exception handler and (ii) toggle error to exception handler (note: this last respects the error_reporting parameter). What would be the default state? Enabled when Hoa is alone, else disabled? How to disable: with a constant (say define('HOA_CORE_EXCEPTION_HANDLER', false)) or with a static method: (say Hoa\Core\Exception::disableHandler())? I have a preference for the second one :-).

I prefer too the second one ;)

And, as i said in #15, i guess we should deactivate it by default, user will activate it if he want.

I agree to add static methods to enable/disable error and exception handlers, but can we have a vote for the default values (/ping @osaris, @CircleCode, @camael24, @jubianchi, @shouze…)?

Moreover, do you have a patch to propose?

+1 for static methods to enable/disable

+1 for disabled by default because we need to make Hoa integration in other tools as smooth as possible if we want it to be widely adopted

+1 for @osaris :)

Ok, so what would be the name for those methods: enableErrorHandler(true | false) and enableExceptionHandler(true | false), on Hoa\Core?

Yep, that's a good naming to me.

Do I add these methods respectively on Hoa\Core\Exception and Hoa\Core\Exception\Error or on Hoa\Core (I propose Hoa\Core since this is an upstream operation: the core “enables” Hoa\Core\Exception\Error for example).

+1 for Hoa\Core

👍 for Hoa\Core

Done: d3d90b3.
@stephpy: If you agree, please, close the issue :-).

You're awesome, thanks ;)