Fix tests.

This commit is contained in:
Sam Rose 2024-10-08 09:56:51 +01:00
parent 820c66be7f
commit a4a90d7456
No known key found for this signature in database
1 changed files with 14 additions and 8 deletions

View File

@ -371,15 +371,21 @@ export class DatabaseImpl implements Database {
return this.performCall(() => { return this.performCall(() => {
return async () => { return async () => {
const response = await directCouchUrlCall(args) const response = await directCouchUrlCall(args)
if (response.status >= 300) { const text = await response.text()
const text = await response.text() if (response.status > 300) {
console.error(`SQS error: ${text}`) let json
throw new CouchDBError( try {
"error while running SQS query, please try again later", json = JSON.parse(text)
{ name: "sqs_error", status: response.status } } catch (err) {
) console.error(`SQS error: ${text}`)
throw new CouchDBError(
"error while running SQS query, please try again later",
{ name: "sqs_error", status: response.status }
)
}
throw json
} }
return (await response.json()) as T return JSON.parse(text) as T
} }
}) })
} }