Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(documents-v2): Catch error and log warning #16207

Merged
merged 3 commits into from
Sep 30, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions libs/api/domains/documents/src/lib/documentV2.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,26 @@ export class DocumentServiceV2 {
documentId: string,
pageSize: number,
): Promise<DocumentPageNumber> {
const res = await this.documentService.getPageNumber(
nationalId,
documentId,
pageSize,
)
const defaultRes = 1
try {
const res = await this.documentService.getPageNumber(
nationalId,
documentId,
pageSize,
)

return {
pageNumber: res ?? 1,
return {
pageNumber: res ?? defaultRes,
}
} catch (exception) {
this.logger.warn('Document page number error', {
category: LOG_CATEGORY,
documentId,
error: exception,
})
thordurhhh marked this conversation as resolved.
Show resolved Hide resolved
return {
pageNumber: defaultRes,
}
}
}

Expand Down
Loading