OpenFn / apollo

GNU Lesser General Public License v2.1
0 stars 2 forks source link

assistant: handle errors better #117

Open josephjclark opened 1 week ago

josephjclark commented 1 week ago

When calling out to anthropic, there are a bunch of errors we might get:

We need to ensure that the chat service returns those errors to Lightning in a fairly responsible way. Ie, with a decent HTTP status code and with a human readable error.

I'd suggest an error structure like this maybe, as the JSON payload:

error: 'LIMIT_EXCEEDED',
message: 'Usage Limit Exceeded',
fix: 'Try again tomorrow or contact your system administrator

I suppose the chat service shouldn't assume it's being called by lightning, but it should still return a good human readable error.