This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

mick11054
mick11054

Hello,

I'm attempting to add a custom exception handler to the October\Rain\Auth\AuthException exception. According to the docs on this page: https://octobercms.com/docs/services/error-log#exception-handling this can be achieved with the following code placed in my Plugin.php file's boot() method:

App::error(function(\October\Rain\Auth\AuthException $exception) {
    // Handle the exception...
});

However, there's no error() method on the App class: Call to undefined method October\Rain\Foundation\Application::error(). It's also missing the fatal() method mentioned on that same documentation page.

Is this documentation based on an older version of Laravel? Since 5.0, I believe exception handling is done differently: http://laravel.com/docs/5.0/errors

What is the best way to listen for these exceptions? I found the October\Rain\Foundation\Exception\Handler class, which fires an exception.beforeRender global Event from the render() method, but none of my listeners seem to pick these up when placed in my Plugin.php file's boot() method:

Event::listen('exception.*', function ($e) {
    // never fires..
});

Event::listen('exception.beforeRender', function ($e, $statusCode, $request) {
    // also never fires..
});

To be clear, the October\Rain\Auth\AuthException exception is thrown when a user attempts to sign in with the wrong credentials. This exception is logged instead of displayed to the user. I would like to change it so that these errors are shown on the front-end and not simply logged.

Thanks in advance for any help!

Last updated

skydiver
skydiver

Hello mick11054, any luck with this?

Thanks.-

Last updated

mick11054
mick11054

skydiver,

Unfortunately, no :(

I've had a heck of a time trying to use event listeners in October, especially with the RainLab User plugin. I made another post over here: https://octobercms.com/forum/post/rainlab-user-plugin-missing-event-listeners asking how I can listen for when a user signs in or signs out. I still haven't found a good way. I ultimately had to make changes to the core files of the plugin. A single line of code added to the onSignin() method fixed the issue for me:

Event::fire('auth.login', [$user]);

I'm not sure how or why they omitted something so simple, which is why I feel like I'm not grasping how they expect this plugin to be extended.

walidh9326228
walidh9326228

Having the same issue

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.