Skip to content

Commit 0473f19

Browse files
jonas-jonasory-bot
authored andcommitted
chore: handle error page without description
GitOrigin-RevId: bb50523321b7769bdd3fdaf0abd55a826283a1be
1 parent ac4da0b commit 0473f19

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
lines changed

packages/elements-react/api-report/elements-react-theme.api.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,6 +1336,10 @@
13361336
"kind": "Content",
13371337
"text": "type OryError = "
13381338
},
1339+
{
1340+
"kind": "Content",
1341+
"text": "{\n correlationId?: string;\n} & ("
1342+
},
13391343
{
13401344
"kind": "Reference",
13411345
"text": "FlowError",
@@ -1361,7 +1365,7 @@
13611365
},
13621366
{
13631367
"kind": "Content",
1364-
"text": ";\n}"
1368+
"text": ";\n})"
13651369
},
13661370
{
13671371
"kind": "Content",
@@ -1373,7 +1377,7 @@
13731377
"name": "OryError",
13741378
"typeTokenRange": {
13751379
"startIndex": 1,
1376-
"endIndex": 7
1380+
"endIndex": 8
13771381
}
13781382
},
13791383
{

packages/elements-react/api-report/elements-react-theme.api.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,11 @@ export type OAuth2Error = {
125125
};
126126

127127
// @public
128-
export type OryError = FlowError | OAuth2Error | {
128+
export type OryError = {
129+
correlationId?: string;
130+
} & (FlowError | OAuth2Error | {
129131
error: GenericError;
130-
};
132+
});
131133

132134
// @public
133135
export function Recovery({ flow, config, children, components: flowOverrideComponents, }: RecoveryFlowContextProps): react_jsx_runtime.JSX.Element;
@@ -169,8 +171,8 @@ export type VerificationFlowContextProps = {
169171

170172
// Warnings were encountered during analysis:
171173
//
172-
// dist/theme/default/index.d.ts:420:5 - (ae-forgotten-export) The symbol "OryClientConfiguration" needs to be exported by the entry point index.d.ts
173-
// dist/theme/default/index.d.ts:443:5 - (ae-forgotten-export) The symbol "OryFlowComponentOverrides" needs to be exported by the entry point index.d.ts
174+
// dist/theme/default/index.d.ts:422:5 - (ae-forgotten-export) The symbol "OryClientConfiguration" needs to be exported by the entry point index.d.ts
175+
// dist/theme/default/index.d.ts:445:5 - (ae-forgotten-export) The symbol "OryFlowComponentOverrides" needs to be exported by the entry point index.d.ts
174176

175177
// (No @packageDocumentation comment for this package)
176178

packages/elements-react/src/theme/default/flows/error.tsx

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ import { useClientLogout } from "../utils/logout"
2727
* @hidden
2828
* @inline
2929
*/
30-
export type OryError = FlowError | OAuth2Error | { error: GenericError }
30+
export type OryError = {
31+
correlationId?: string
32+
} & (FlowError | OAuth2Error | { error: GenericError })
3133

3234
/**
3335
* An OAuth2 error response.
@@ -201,20 +203,28 @@ export function Error({
201203
<p className="text-sm text-interface-foreground-default-secondary">
202204
Time: <code>{parsed.timestamp?.toUTCString()}</code>
203205
</p>
204-
<p className="text-sm text-interface-foreground-default-secondary">
205-
Message:{" "}
206-
<code data-testid={"ory/screen/error/message"}>
207-
{parsed.reason}
208-
</code>
209-
</p>
206+
{error.correlationId && (
207+
<p className="text-sm text-interface-foreground-default-secondary">
208+
Correlation ID: <code>{error.correlationId}</code>
209+
</p>
210+
)}
211+
{parsed.reason && (
212+
<p className="text-sm text-interface-foreground-default-secondary">
213+
Message:{" "}
214+
<code data-testid={"ory/screen/error/message"}>
215+
{parsed.reason}
216+
</code>
217+
</p>
218+
)}
210219

211220
<div>
212221
<button
213-
className="text-interface-foreground-default-primary underline"
222+
className="cursor-pointer text-interface-foreground-default-primary underline"
214223
onClick={() => {
215224
const text = `${parsed.id ? `ID: ${parsed.id}` : ""}
216225
Time: ${parsed.timestamp?.toUTCString()}
217226
${parsed.reason ? `Message: ${parsed.reason}` : ""}
227+
${error.correlationId ? `Correlation ID: ${error.correlationId}` : ""}
218228
`
219229
void navigator.clipboard.writeText(text)
220230
}}

0 commit comments

Comments
 (0)