Skip to content

Commit ca19ae1

Browse files
committed
[APM] Make error.exception.stacktrace.line optional
1 parent 0c25cb5 commit ca19ae1

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/FrameHeading.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const FrameHeading: React.FC<Props> = ({ stackframe, isLibraryFrame }) => {
3434
const FileDetail = isLibraryFrame
3535
? LibraryFrameFileDetail
3636
: AppFrameFileDetail;
37-
const lineNumber = stackframe.line.number;
37+
const lineNumber = stackframe.line?.number ?? 0;
3838

3939
const name =
4040
'filename' in stackframe ? stackframe.filename : stackframe.classname;
@@ -46,7 +46,7 @@ const FrameHeading: React.FC<Props> = ({ stackframe, isLibraryFrame }) => {
4646
{lineNumber > 0 && (
4747
<Fragment>
4848
{' at '}
49-
<FileDetail>line {stackframe.line.number}</FileDetail>
49+
<FileDetail>line {lineNumber}</FileDetail>
5050
</Fragment>
5151
)}
5252
</FileDetails>

x-pack/legacy/plugins/apm/public/components/shared/Stacktrace/Stackframe.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ export function Stackframe({
7777
function hasLineContext(
7878
stackframe: IStackframe
7979
): stackframe is IStackframeWithLineContext {
80-
return stackframe.line.hasOwnProperty('context');
80+
return stackframe.line?.hasOwnProperty('context') || false;
8181
}

x-pack/legacy/plugins/apm/typings/es_schemas/raw/fields/Stackframe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type IStackframeBase = {
1515
vars?: {
1616
[key: string]: unknown;
1717
};
18-
line: {
18+
line?: {
1919
number: number;
2020
};
2121
} & ({ classname: string } | { filename: string });

0 commit comments

Comments
 (0)