Jump to content

Hooks with USE statements were wrapped in a try/catch


Recommended Posts

@Stuart Silvester, I tried to find the topic/post where I asked you about this but didn't find it so I'm creating a new topic.

This shows as FIXED in 4.7.7 but is still a problem on 4.7.11.1. That's how the app hook shows after the app install:

/**
 * @mixin \IPS\core\Messenger\Message
 */
class messengerenh_hook_messageModel extends _HOOK_CLASS_
{
	use \IPS\Content\Reactable
	{
		try
		{
			\IPS\Content\Reactable::canReact as allowedToReact;
		}
		catch ( \Error | \RuntimeException $e )
		{
			if( \defined( '\IPS\DEBUG_HOOKS' ) AND \IPS\DEBUG_HOOKS )
			{
				\IPS\Log::log( $e, 'hook_exception' );
			}

			if ( method_exists( get_parent_class(), __FUNCTION__ ) )
			{
				return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
			}
			else
			{
				throw $e;
			}
		}
	}

...

If I clean the code to:

/**
 * @mixin \IPS\core\Messenger\Message
 */
class messengerenh_hook_messageModel extends _HOOK_CLASS_
{
	use \IPS\Content\Reactable
	{
		\IPS\Content\Reactable::canReact as allowedToReact;
	}

...

it works as expected.

Thank you.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...