Skip to content
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

Handle NoSuchBucket Exception Gracefully and Provide User-Friendly Error Response #473

Open
chavda-bhavik opened this issue Jan 25, 2024 · 0 comments
Labels
bug Something isn't working enhancement New feature or request good first issue Good for newcomers

Comments

@chavda-bhavik
Copy link
Collaborator

  • When a developer provides S3 details to the application and the application starts storing files in S3, the AWS SDK throws a NoSuchBucket exception if the specified bucket does not exist.
  • Currently, this exception is not handled gracefully, leading to a backend application crash.
  • To improve the user experience, we should control this exception and return a user-friendly error response to the frontend instead of crashing the backend application.
  • It's an important case when working with Localstack on local computer.

Steps to Reproduce:

  1. Provide valid S3 details, and invalid bucket name in the API env configuration.
  2. Start the application.
  3. Attempt to store a file in S3 using the application.

Current Behavior:
The backend application crashes with a NoSuchBucket exception when the specified bucket does not exist.

Expected Behavior:
The application should handle the NoSuchBucket exception gracefully and return a well-formatted error response to the front end, indicating that the specified bucket does not exist.

Proposed Solution:

  • Catch the NoSuchBucket exception when interacting with the AWS SDK.
  • Instead of letting the exception propagate and crash the application, handle it with try...catch and construct an error response.
  • Include relevant information in the error response, such as the bucket name provided by the developer.
  • Return the error response to the frontend for display.

Additional Information:

  • It would be beneficial to log the exception for debugging purposes.

Priority:
High

@chavda-bhavik chavda-bhavik added bug Something isn't working enhancement New feature or request good first issue Good for newcomers labels Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant