Skip to content

Commit

Permalink
[APM] Treat error.exception.stacktrace.line as optional (#55733)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgieselaar committed Jan 24, 2020
1 parent 6beb2b2 commit b39076e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -15,7 +15,7 @@ type IStackframeBase = {
vars?: {
[key: string]: unknown;
};
line: {
line?: {
number: number;
};
} & ({ classname: string } | { filename: string });
Expand Down

0 comments on commit b39076e

Please sign in to comment.