-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Feature: Try/Catch mechanisim #98
Comments
Are you seeing errors? It would be preferred to fix this while fixing an actual error, otherwise optimization for sake of optimization is not needed at this time. |
No, I am not seeing any errors, I just noticed that when I started working on #88 |
The code refactor and description generation button click handlers do have try/catch blocks implemented to handle errors generated from the API calls.
ai/src/content-scripts/components/GenerateAIDescription/DescriptionGeneratorButton.ts Lines 26 to 77 in 805a730
|
The issue with warping the whole function in try/catch is that when I tried to use the functions inside this by itself, like: getDescript, description stream, I had to warp that with a try/cacth again. I think having try catch the base would be more ideal. what your thoughts? @Anush008 |
The idea is to have the caller handle the thrown errors as required. |
I think more specific errors could be handled, but we'll just log them all anyway, no other mechanism to deal with any of the for now. So this can be done later. |
So, should we keep this open until it's done later? So that we will not forget it? |
It's just that when you call functions that throw, you can handle them as required. There's no way around it. It isn't appropriate to handle the error in the function definition since the caller might need a different behaviour on error. It isn't something that needs to be fixed or improved. |
You can think about it as something similar to API calls, when you got 401 for example it's not throwing an error, but it's returning a response with Here you can check the insights project logic: |
@a0m0rajab can you share an example of an error from our project? That'll help in tackling the issue too, if there is one :) |
@diivi it's more of a I could not use the util functions since that did not provide a try/catch stuff rather than an error I faced. |
Type of feature
🍕 Feature
Current behavior
The fetch API has no try/catch mechanism right now to check the errors from the server side, I think it would be great to have such a thing.
An example from the insights project: https://github.com/open-sauced/insights/blob/beta/lib/hooks/createHighlights.ts#L18
Suggested solution
No response
Additional context
It would be great to have such a thing to debug and understand errors when it happens.
Code of Conduct
Contributing Docs
The text was updated successfully, but these errors were encountered: