All docs returns no docs if 404.

This commit is contained in:
mike12345567 2024-09-24 15:47:07 +01:00
parent 6d8921978b
commit ad60f8a811
1 changed files with 15 additions and 1 deletions

View File

@ -336,7 +336,21 @@ export class DatabaseImpl implements Database {
params: DatabaseQueryOpts
): Promise<AllDocsResponse<T>> {
return this.performCall(db => {
return () => db.list(params)
return async () => {
try {
return (await db.list(params)) as AllDocsResponse<T>
} catch (err: any) {
if (err.status === 404) {
return {
offset: 0,
total_rows: 0,
rows: [],
}
} else {
throw err
}
}
}
})
}