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

fix(my-pages): Law and Order - error handling #16506

Merged
merged 7 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 9 additions & 1 deletion libs/api/domains/documents/src/lib/documentV2.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ export class DocumentServiceV2 {
const actions = document.actions?.filter(
(action) => action.type !== 'alert' && action.type !== 'confirmation',
)
if (document.urgent)
this.logger.info('Urgent document fetched', {
documentId: documentId,
includeDocument,
})

return {
...document,
publicationDate: document.date,
Expand Down Expand Up @@ -484,7 +490,7 @@ export class DocumentServiceV2 {

// we return the document even if the actions are faulty, logged for tracability
if (hasEmpty) {
this.logger.warn('No title or data in actions array', {
this.logger.info('No title or data in actions array, return undefined', {
category: LOG_CATEGORY,
id,
})
Expand All @@ -511,6 +517,8 @@ export class DocumentServiceV2 {
}
})

// Log the actions to ensure that they are mapped correctly
this.logger.info('Actions mapped successfully', { actions: mapped })
return mapped
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ export class LawAndOrderResolver {
@Args('locale', { type: () => String, nullable: true })
locale: Locale = 'is',
) {
return this.lawAndOrderService.getLawyers(user, locale)
return this.auditAndHandle(
'getLawyers',
'lawyers',
this.lawAndOrderService.getLawyers(user, locale),
user,
)
}

@Mutation(() => DefenseChoice, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const DefenderChoices: FC<React.PropsWithChildren<Props>> = ({
</>
))}

{!popUp && (
{!popUp && !error && (
<Button
type="submit"
size="small"
Expand All @@ -201,7 +201,7 @@ const DefenderChoices: FC<React.PropsWithChildren<Props>> = ({
)}
</Button>
)}
{popUp && (
{popUp && !error && (
<Box
display="flex"
flexDirection="row"
Expand Down
Loading