Skip to content

[Telemetry] Bug in trackException() where data is undefined #14184

@danielayala94

Description

@danielayala94

Problem Description

In #14146, trackException() throws an exception as data is undefined, in reference to this part of the function:

// Copy miscellaneous system error fields into the codedError.data object
    const syscallExceptionFieldsToCopy = ['errno', 'syscall', 'code'];
    for (const f of syscallExceptionFieldsToCopy) {
      if ((error as any)[f]) {
        codedErrorStruct.data.codedError.data[f] = (error as any)[f]; // This throws the exception.
      }
    }

Steps To Reproduce

Needs to introduce a unit test, initially looking for codedError.data to be {} (see codedErrorStruct definition).

Expected Results

trackException() should not throw.

CLI version

15.0.1

Environment

See #14146

Community Modules

No response

Target Platform Version

None

Target Device(s)

No response

Visual Studio Version

None

Build Configuration

None

Snack, code example, screenshot, or link to a repository

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions