ai
ai copied to clipboard
"Unhandled runtime error"—best practices for error handling in API routes?
If your backend throws an error before sending the initial response, it looks like the generator function responsible for grabbing the response inside the useCompletion hook just keeps chugging along, even though the response isn't streamable. This throws an error I seem to be unable to try/catch by e.g. wrapping my complete call.
Is there another way to do this?