stack-auth / stack

Open-source Clerk/Auth0 alternative
https://stack-auth.com
Other
3k stars 191 forks source link

Improve Error Handling in API Handlers #141

Closed kfahad5607 closed 4 weeks ago

kfahad5607 commented 1 month ago

Currently, there is no error handling in the API handlers. When something goes wrong, the server returns an Internal Server Error without providing meaningful feedback to the user.

Few Examples

  1. Adding an Existing User to a Team

    • Action: Attempt to add a user who is already a member of a team
    • Result: Unique constraint fails
    • Screenshot: Screenshot from 2024-07-21 18-54-33

Expected Results

The API should handle errors gracefully and return meaningful, user-friendly error messages, such as:

Additional Notes

These are just a few examples of the endpoints affected. There are many more endpoints that currently lack proper error handling.

I would love to work on this issue. Please assign it to me if possible.

sarthaklaptop commented 1 month ago

I can work on this issue

fomalhautb commented 1 month ago

Hey thanks for reporting, we are actively fixing this issue now!

kfahad5607 commented 1 month ago

I would be more than happy to help in any way I can and would appreciate being assigned tasks.

kumarvinayak490 commented 1 month ago

I would be happy to work on this issue and implement best error handling practices going on in the industry. Looking forward to hearing from you

N2D4 commented 1 month ago

Thanks for reporting this @kfahad5607 ! I assigned you to the issue, let me know if you're no longer interested in it

kfahad5607 commented 1 month ago

Hi @N2D4,

Thank you for assigning this issue to me. Are there any specific instructions or things I should keep in mind before I start working on it?

kfahad5607 commented 1 month ago

Queries Regarding Error Handling for Route Handlers

Few endpoints already have proper error handling:

  1. Adding an Existing User to a Team image

  2. Getting User Teams with an Invalid User ID image

However, some endpoints do not have error handling:

  1. Deleting a Non-Existent User from a Team image

Queries: