We want to be able to throw errors in the query route, but since it's a streaming response, the response status is already sent before the request begins. Then when I raise an error it becomes a Runtime error cause this isn't automatically handled.
I think we need to adjust the streaming response class to something that can try/capture errors and forward them to the frontend as events and then close the stream. Then also modify the frontend to handle those events as 'error events' and show the error snackbar with their details.
It's annoying cause now any error that's happening can't really propagate. We only see "error querying assistant". In snowflake at least, there are some errors that'll only show up when you're actually performing queries.
Idk if there's another way of dealing with this. This is just the first solution that popped to mind. Quick search of issues didn't show a better one.
We want to be able to throw errors in the query route, but since it's a streaming response, the response status is already sent before the request begins. Then when I raise an error it becomes a Runtime error cause this isn't automatically handled.
I think we need to adjust the streaming response class to something that can try/capture errors and forward them to the frontend as events and then close the stream. Then also modify the frontend to handle those events as 'error events' and show the error snackbar with their details.
It's annoying cause now any error that's happening can't really propagate. We only see "error querying assistant". In snowflake at least, there are some errors that'll only show up when you're actually performing queries.
Idk if there's another way of dealing with this. This is just the first solution that popped to mind. Quick search of issues didn't show a better one.
https://github.com/tiangolo/fastapi/discussions/10138