All docs returns no docs if 404.
This commit is contained in:
parent
6d8921978b
commit
ad60f8a811
|
@ -336,7 +336,21 @@ export class DatabaseImpl implements Database {
|
||||||
params: DatabaseQueryOpts
|
params: DatabaseQueryOpts
|
||||||
): Promise<AllDocsResponse<T>> {
|
): Promise<AllDocsResponse<T>> {
|
||||||
return this.performCall(db => {
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue