Skip to content

Commit a9ab2bf

Browse files
Update samples/e2e-testcases/index.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 084be03 commit a9ab2bf

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

samples/e2e-testcases/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,21 @@ function compareResults(
238238
*/
239239
function formatError(error: unknown): string {
240240
if (error instanceof Error) {
241+
const details = error as Error & {
242+
code?: unknown;
243+
details?: unknown;
244+
};
245+
246+
const parts = [details.message, details.details]
247+
.filter((value): value is string => typeof value === 'string' && value.length > 0);
248+
249+
if (typeof details.code === 'number' || typeof details.code === 'string') {
250+
parts.unshift(`code ${details.code}`);
251+
}
252+
253+
if (parts.length > 1 || (parts.length === 1 && parts[0] !== error.message)) {
254+
return parts.join(' - ');
255+
}
241256
return error.message;
242257
}
243258

0 commit comments

Comments
 (0)