Skip to content

Refactor DOMException handling code to avoid redundant exceptions generation #724

@RedMickey

Description

@RedMickey

Hello, we are the development team of VS Code extension for debugging React Native apps (vscode-react-native). whatwg-fetch package is used in React Native lib. In our extension we debug React Native apps as a Node.js processes. Node JS global context doesn't contain DOM modules, so "exports.DOMException is not a constructor" exception is generated in whatwg-fetch package if fetch function is used in a React Native project.
Could it be better to firstly verify if there is DOMException module in environment global context and only after that use try/catch construction? If DOMException module doesn’t exist it can be better to create this module without exception generation.
Here is the issue for the corresponding case in the debugger extension repository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions