Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Early Exception Issue #18

Open
weierophinney opened this issue Dec 31, 2019 · 4 comments
Open

Early Exception Issue #18

weierophinney opened this issue Dec 31, 2019 · 4 comments

Comments

@weierophinney
Copy link
Contributor

Not sure if this is even solvable since the component and its associated database connections (from OAuth) are required early, but here's the issue:

As any good developer should have, we have extensive error reporting and logging in place, emails, sms messages, etc and we have wrapped this logic into a module. But in this case, we had no notice of a critical error.

Our database server went away. The MvcAuth component attempts to retrieve a DB instance from the OAuth component on Bootstrap. Since the database server went offline, it rightly threw an exception. However, since this all occurred on bootstrap, the code in our ErrorReporter module never executed and the user was greeted with a blank white page. Since this occurred on bootstrap we couldn't route the user to a pretty "Whoops" page nor were we alerted.

The only solution at this time was to wrap the contents of public/index.php in a try catch statement, code out some error reporting and issue a die() statement to the user. Furthermore, because this all happens on bootstrap, the error occurs on pages where the DB connector and the Auth aren't even required.

In my opinion, this instantiation and configuration should happen elsewhere in the event chain so that the developer can programmatically and intelligently handle such errors.


Originally posted by @spectravp at zfcampus/zf-mvc-auth#54

@weierophinney
Copy link
Contributor Author

Can you not load your ErrorReporter module before the offending module, in this case MvcAuth ?


Originally posted by @EMCP at zfcampus/zf-mvc-auth#54 (comment)

@weierophinney
Copy link
Contributor Author

Tried that. Doesn't work cause the exception stops the whole bootstrap process in its tracks. No standard error routing, just kaput.


Originally posted by @spectravp at zfcampus/zf-mvc-auth#54 (comment)

@weierophinney
Copy link
Contributor Author

Perhaps this means modifying the factory in which Mvc-Auth generates it's objects? I've been wondering how to code defensively in cloud environments myself, since this can and will happen.


Originally posted by @EMCP at zfcampus/zf-mvc-auth#54 (comment)

@weierophinney
Copy link
Contributor Author

This also means that console routes fail. We now have a single application split into multiple instances simply to bypass the MvcAuth component which is terrible.


Originally posted by @spectravp at zfcampus/zf-mvc-auth#54 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant