[APM] Treat error.exception.stacktrace.line as optional (#55733)

This commit is contained in:
Dario Gieselaar 2020-01-24 14:31:51 +01:00 committed by GitHub
parent 6beb2b2c06
commit b39076e2bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -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>

View file

@ -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;
}

View file

@ -15,7 +15,7 @@ type IStackframeBase = {
vars?: {
[key: string]: unknown;
};
line: {
line?: {
number: number;
};
} & ({ classname: string } | { filename: string });