The best error handling mechanism I've seen so far. I have a question though.
I understand that i have to require this in the index file:
const { handleError } = require("path-to-code")
Will I have to include this code
const { ErrorHandler } = require("path-to-code");
in every file where I need to handle errors apart from the index file?
It's like any other module, you will have to require/import it anywhere you need to use it. No specific exceptions, it depends on the use case.
Thank you so much
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The best error handling mechanism I've seen so far. I have a question though.
I understand that i have to require this in the index file:
Will I have to include this code
in every file where I need to handle errors apart from the index file?
It's like any other module, you will have to require/import it anywhere you need to use it. No specific exceptions, it depends on the use case.
Thank you so much