Skip to content

Commit

Permalink
[APM] Treat error.exception.stacktrace.line as optional (#55733) (#55840
Browse files Browse the repository at this point in the history
)

Co-authored-by: Elastic Machine <[email protected]>
dgieselaar and elasticmachine authored Jan 29, 2020
1 parent cc862c7 commit a6d7288
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ const FrameHeading: React.FC<Props> = ({ 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<Props> = ({ stackframe, isLibraryFrame }) => {
{lineNumber > 0 && (
<Fragment>
{' at '}
<FileDetail>line {stackframe.line.number}</FileDetail>
<FileDetail>line {lineNumber}</FileDetail>
</Fragment>
)}
</FileDetails>
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ type IStackframeBase = {
vars?: {
[key: string]: unknown;
};
line: {
line?: {
number: number;
};
} & ({ classname: string } | { filename: string });

0 comments on commit a6d7288

Please sign in to comment.