hendt/ebay-api

Adding default error handler logic

Closed this issue · 5 comments

Hello, is there a way to add my own default error handler logic whenever the api receives an error?

dantio commented

Hey,
there is no way right now to add custom error handler. But I can implement that.
What is your use case?

I'd want to send myself a notifcation via EMAIL/TEXT whenever the ebay API returns an error.

dantio commented

you can wrap the api call

try {
await eBayApi.some.call()
} catch (ex) {
sendErrorMail(ex.message);
}

I'm utilizing multiple ebay api calls for my program and either one of them could fail, I could do as what you said and wrap each ebay api call with a try catch, but it just seems redundant imo.

I was thinking I could ovveride the ebay error function but I'm not knowledgeable enough to do that yet

dantio commented

Do you use any framework? Express? NestJS? You should look up in the documentation how to catch these errors and log properly.