From b39076e2bd93d405749e3a88ae36c060a67fbff3 Mon Sep 17 00:00:00 2001 From: Dario Gieselaar Date: Fri, 24 Jan 2020 14:31:51 +0100 Subject: [PATCH] [APM] Treat error.exception.stacktrace.line as optional (#55733) --- .../apm/public/components/shared/Stacktrace/FrameHeading.tsx | 4 ++-- .../apm/public/components/shared/Stacktrace/Stackframe.tsx | 2 +- .../plugins/apm/typings/es_schemas/raw/fields/Stackframe.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/FrameHeading.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/FrameHeading.tsx index 51056fae50360..94cad732d5a94 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/FrameHeading.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/FrameHeading.tsx @@ -34,7 +34,7 @@ const FrameHeading: React.FC = ({ stackframe, isLibraryFrame }) => { const FileDetail = isLibraryFrame ? LibraryFrameFileDetail : AppFrameFileDetail; - const lineNumber = stackframe.line.number; + const lineNumber = stackframe.line?.number ?? 0; const name = 'filename' in stackframe ? stackframe.filename : stackframe.classname; @@ -46,7 +46,7 @@ const FrameHeading: React.FC = ({ stackframe, isLibraryFrame }) => { {lineNumber > 0 && ( {' at '} - line {stackframe.line.number} + line {lineNumber} )} diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Stackframe.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Stackframe.tsx index a307cc56cc71a..3586368db84fc 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Stackframe.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Stackframe.tsx @@ -77,5 +77,5 @@ export function Stackframe({ function hasLineContext( stackframe: IStackframe ): stackframe is IStackframeWithLineContext { - return stackframe.line.hasOwnProperty('context'); + return stackframe.line?.hasOwnProperty('context') || false; } diff --git a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Stackframe.ts b/x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Stackframe.ts index 993fac46ad7cb..05b0eb88da40b 100644 --- a/x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Stackframe.ts +++ b/x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Stackframe.ts @@ -15,7 +15,7 @@ type IStackframeBase = { vars?: { [key: string]: unknown; }; - line: { + line?: { number: number; }; } & ({ classname: string } | { filename: string });