pieces-app / example-typescript

A React example project showing how to get started with Pieces TS SDK.
MIT License
42 stars 50 forks source link

feat: Wrap API Calls in try/catch Blocks in Assets.tsx #128

Closed Arindam200 closed 4 months ago

Arindam200 commented 5 months ago

Description

The current implementation in Assets.tsx may not consistently handle errors from API calls. To improve error handling and ensure that any issues are properly caught and logged, we should wrap all API calls in try/catch blocks.

Proposed Solution

Refactor the code in Assets.tsx to wrap all API calls in try/catch blocks. This will ensure that any errors are caught and can be handled appropriately, improving the robustness of the application.

Detailed Steps

  1. Identify API Calls:

    • Locate all instances in Assets.tsx where API calls are made.
  2. Wrap in try/catch:

    • Wrap each API call in a try/catch block.
    • Ensure that any errors are logged or handled appropriately within the catch block.
  3. Testing:

    • Ensure that the refactored code is thoroughly tested.
    • Write unit tests to verify that errors are properly caught and handled.
    • Test the application to ensure that it behaves correctly when API calls fail.

Benefits

Additional Notes

By wrapping API calls in try/catch blocks in Assets.tsx, we can enhance the error handling capabilities of the application, making it more reliable and easier to debug.

dhirajudhani commented 5 months ago

Hi @Arindam200 I love to contribute this issue can you assign this to me

Arindam200 commented 5 months ago

Go Ahead @dhirajudhani

dhirajudhani commented 5 months ago

hii @Arindam200 I have created a pr request please review and if there are any changes please let me know