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

Dumb Question: Awilix perspective on error handling? #3

Closed
donjae opened this issue Jul 30, 2016 · 3 comments
Closed

Dumb Question: Awilix perspective on error handling? #3

donjae opened this issue Jul 30, 2016 · 3 comments
Labels

Comments

@donjae
Copy link

donjae commented Jul 30, 2016

Apologies in advance for the dumb weird question.

It seems like awilix's preferred method of catching errors is from the scope(?) of the container, correct? Or is better to create it first then catch errors whenever creating services attached to it? Or is catching errors on a (general) api level, with a generic handler be the best? I understand it's kind of depends on the project, but I'm curious what would be the best practice in the context of awilix.

Let me know if this question is unclear. Not sure if you've seen silicon valley, but I feel like Bernice asking these questions and using your amazing framework!

@jeffijoe
Copy link
Owner

jeffijoe commented Jul 30, 2016

Of course I've seen Sillicon Valley, any developer worth their salt has! ;)

Awilix does not really deal with error handling - once you've resolved a service it's ready to go; any errors thrown while using these objects is out of Awilix' scope (no pun intended).

In other words, Awilix has nothing to do with error handling. :)

@donjae
Copy link
Author

donjae commented Jul 30, 2016

Awilix does not really deal with error handling - once you've resolved a service it's ready to go;

Correct me if I'm wrong, but the order of how awilix functions is:
Registering Awilix scope > creating/resolving service

So it is not recommended to create a middleware to pass errors through Awilix and registering it as an error? It's better just to do it through a service file/level?

@jeffijoe
Copy link
Owner

Awilix is an IoC container, and does not deal with error handling, thats done by whatever framework you're using. I wouldnt use the scope to register errors, only things like session state (thats what scopes are for). Hope that helps. :)

~ Jeff Hansen

On 30 Jul 2016, at 17:57, donjae notifications@github.com wrote:

Awilix does not really deal with error handling - once you've resolved a service it's ready to go;
Correct me if I'm wrong, but the order of how awilix functions is:
Registering Awilix scope > creating/resolving service

So it is not recommended to create a middleware to pass errors through Awilix and registering it as an error? It's better just to do it through a service file/level?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@donjae donjae closed this as completed Aug 1, 2016
jeffijoe pushed a commit that referenced this issue Jun 7, 2017
Removed unneeded has routine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants