You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any possible error handling for things like GetAnime? for example the id 500 does not exist on MAL and I use Jikan.net for a discord bot I am currently coding but am having trouble trying to do some error handling when something, like I mentioned above, happens. This could be very niche but would be cool if there's some built-in error handling or if you could give me some tips on how to handle situations like that.
The text was updated successfully, but these errors were encountered:
I think it's up to the user to decide what to do in a situation when the error is encountered - by default all the errors are thrown to the upper level so the user can catch and decide if they want to retry based on error code. Some of them indicate that retrying is won't work, for example non existent id that you mention (it will throw JikanRequestException with StatusCode 404). No the other hand you might met status error 429, meaning there are too many request at once coming from you bot - you might want to wait a little bit and retry the call.
On the other hand wrapper has built-in error supression. You just pass second parameter in a constructor like this: var jikan = new Jikan(true, true)
Now every failed result will be returned as null and you just perform a null check. But I would still suggest using try catch: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/try-catch
Is there any possible error handling for things like GetAnime? for example the id 500 does not exist on MAL and I use Jikan.net for a discord bot I am currently coding but am having trouble trying to do some error handling when something, like I mentioned above, happens. This could be very niche but would be cool if there's some built-in error handling or if you could give me some tips on how to handle situations like that.
The text was updated successfully, but these errors were encountered: