-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modernisering feilmeldingskode (#6482)
* Ny komponent for stor feilmelding på side. Bruker aksel komponenter og dropper intl støtte for å forenkle kodebasen. * Skriver om ForbiddenPage komponent til å bruke ny BigError komponent. Lager også separat, moderne storybook fil for den, og flytter test inn i storybook. * Skriver om NotFoundPage komponent til å bruke ny BigError komponent. Lager også separat, moderne storybook fil for den, og flytter test inn i storybook. * Skriver om UnauthorizedPage komponent til å bruke ny BigError komponent. Lager også separat, moderne storybook fil for den, og flytter test inn i storybook. * Skriver om IngenBehandlingValgtPanel komponent til å ikkje bruke intl lenger Lager også separat, moderne storybook fil for den, og flytter test inn i storybook. * Fjerna ubrukt textCode prop på ErrorBoundary, lagt til storybook test * Endra ErrorPage til å bruke BigError, fjerna ErrorPageWrapper. Lage samtidig story for ErrorPage og flytte test inn der. * Legg til standardfeilmelding og større margin på BigError. * Justert feilmelding som viser når ErrorBoundary blir utløst. Oppfordrer brukeren til å laste sida på nytt for å prøve igjen, og så melde frå viss det ikkje hjalp. * ErrorBoundary viser no referanse til sentry rapport. Slik at saksbehandler kan inkludere denne viss feil blir rapportert inn, og forenkle vår feilsøking. * Flytta sak-infosider til v2/gui/src/sak/feilmeldinger. Sletta gammal sak-infosider pakke. Gjere og nødvendige tilpassinger for at kode skal kompilere under v2/. Bytter og namn på ny v2 sak/infomeldinger til sak/feilmeldinger. Justerer title i tilhøyrande storybook filer for å matche ny filsti. * Fiks så CopyButton på ErrorPage blir inline i feilmelding. * typofix i BigError.tsx * NetworkErrorPage komponent for bruk ved nettverksfeil lagt til. Oppfordrer saksbehandler til å prøve igjen ved nettverksfeil, og inkludere litt feilsøkingsinfo ved innrapportering av feil som ikkje løyser seg ved retry. * Handter nettverksfeil i BehandlingTilbakekrevingIndex. Viser feilmelding istadenfor å prøve å køyre vidare med manglande data viss lasting av data frå server feiler. * Fjern utdatert referanse til sak-infosider, fiks ulovlig import path. * css module typegen * legg til "--allow-empty" på lint-staged hook. Ellers vart commit av generert typescript deklarasjon for css modul blokkert. * Behold quotes i modules.d.css.ts filer prettier fjerner disse, men då feila typed-css-modules sjekken etterpå, så må beholde disse quotes. * Revert "legg til "--allow-empty" på lint-staged hook." This reverts commit b0d6b30.
- Loading branch information
Showing
40 changed files
with
454 additions
and
354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { AxiosError } from 'axios'; | ||
|
||
interface ErrorInfo { | ||
navCallId: string | undefined; | ||
statusCode: number | undefined; | ||
} | ||
|
||
/** | ||
* Kan brukast for å hente ut meta informasjon frå AxiosError som har skjedd. | ||
* Brukast for å vise referanse i feilmelding til bruker, slik at denne kan inkluderast i evt feilmelding vidare. | ||
* | ||
* @param error feil som har oppstått | ||
* @returns objekt med Nav-Callid string og http status kode for respons viss denne info finnast. | ||
*/ | ||
export const extractErrorInfo = (error: unknown): Readonly<ErrorInfo> => { | ||
const resp: ErrorInfo = { | ||
navCallId: undefined, | ||
statusCode: undefined, | ||
}; | ||
if (error instanceof AxiosError) { | ||
const callId = error.config.headers.get('Nav-Callid'); | ||
if (typeof callId === 'string') { | ||
resp.navCallId = callId; | ||
} | ||
resp.statusCode = error.status; | ||
} | ||
return resp; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import ErrorBoundary from './ErrorBoundary.js'; | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import { fn, expect } from '@storybook/test'; | ||
import { useEffect } from 'react'; | ||
|
||
const meta = { | ||
title: 'sak/sak-app', | ||
component: ErrorBoundary, | ||
} satisfies Meta<typeof ErrorBoundary>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
const NonFailingChild = () => <p>Nothing to see here, move along.</p>; | ||
|
||
const FailingChild = () => { | ||
useEffect(() => { | ||
throw new Error('TEST FAIL'); | ||
}, []); | ||
return <p>Error boundary should be displayed instead of this</p>; | ||
}; | ||
|
||
export const ErrorBoundaryNotTriggered: Story = { | ||
args: { | ||
errorMessageCallback: fn(), | ||
children: <NonFailingChild />, | ||
}, | ||
play: async ({ args }) => { | ||
await expect(args.errorMessageCallback).toHaveBeenCalledTimes(0); | ||
}, | ||
}; | ||
|
||
export const ErrorBoundaryTriggered: Story = { | ||
args: { | ||
errorMessageCallback: fn(), | ||
children: <FailingChild />, | ||
}, | ||
play: async ({ canvas, args }) => { | ||
await expect(args.errorMessageCallback).toHaveBeenCalledOnce(); | ||
await expect(canvas.getByRole('heading')).toHaveTextContent( | ||
'Det har oppstått en teknisk feil i denne behandlingen.', | ||
); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
packages/sak-infosider/src/IngenBehandlingValgtPanel.spec.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.