Skip to content

The empty catch block silently swallows all errors without any fallback behavior or logging. Consider adding a comment explaining what specific errors are expected (like accessing prototype on Proxy objects) and potentially log unexpected errors in development mode. #1778

@manudeli

Description

@manudeli

The empty catch block silently swallows all errors without any fallback behavior or logging. Consider adding a comment explaining what specific errors are expected (like accessing prototype on Proxy objects) and potentially log unexpected errors in development mode.

    } catch (err) {
      // If accessing prototype throws, it's not a constructor. This can happen with Proxy objects or in restricted environments.
      // Only TypeError is expected here; log unexpected errors in development mode.
      if (process.env.NODE_ENV !== 'production') {
        if (!(err instanceof TypeError)) {
          console.error('Unexpected error in matchError when accessing prototype:', err);
        }
      }

Originally posted by @Copilot in #1760 (comment)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions