The CLI uses two primary mechanisms to classify non-fatal errors as environmental issues:
shouldReportErrorAsUnexpected: Determines if an error should be treated as a CLI bug.errorMessageImpliesEnvironmentIssue: Checks if an error message matches known environmental patterns.
Common categories for environmental issues include:
- File System Permission Issues: e.g.,
EACCES: permission denied. - Network Connectivity Issues: e.g., DNS failures or
socket hang up. - Resource Contention: e.g.,
EBUSY: resource busy or locked. - External Tool Version Mismatches: e.g., Node/npm version incompatibilities.
- Platform-Specific Issues: OS-level restrictions (Windows vs. POSIX).
Guidelines for adding new patterns:
- Be conservative: Only add highly generic, cross-cutting messages.
- Ensure stability: Use precise substrings that are unlikely to change across Node.js versions or platforms.
- Avoid business logic: Do not include strings related to Shopify APIs or specific business logic; those should be handled locally in the code where they occur.
const environmentIssueMessages = [
'EPERM: operation not permitted, scandir',
'EPERM: operation not permitted, rename',
'EACCES: permission denied',
'EPERM: operation not permitted, symlink',
'This version of npm supports the following node versions',
'EBUSY: resource busy or locked',
'ENOTEMPTY: directory not empty',
'getaddrinfo ENOTFOUND',
'Client network socket disconnected before secure TLS connection was established',
'spawn EPERM',
'socket hang up',
]