Commit 4972a4e
committed
Fix: Move voyageai.Client() creation inside try/except block
The voyageai.Client() constructor can raise AuthenticationError if the
API key is empty or invalid. Previously, this was happening outside the
try/except block that catches Voyage AI exceptions, causing the error
to be caught by the generic Exception handler and returned as a 500
error instead of a 401.
This fix moves the client creation inside the try block so that
AuthenticationError from the constructor is properly caught and
converted to a VoyageAuthError with a 401 status code.1 parent 727f84f commit 4972a4e
1 file changed
Lines changed: 5 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | 335 | | |
339 | | - | |
340 | | - | |
| 336 | + | |
| 337 | + | |
341 | 338 | | |
342 | 339 | | |
343 | 340 | | |
| |||
1373 | 1370 | | |
1374 | 1371 | | |
1375 | 1372 | | |
1376 | | - | |
1377 | | - | |
1378 | | - | |
1379 | 1373 | | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
1380 | 1377 | | |
1381 | 1378 | | |
1382 | 1379 | | |
| |||
0 commit comments