Skip to content

Commit

Permalink
fix: handle ModuleLoadError from hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Oct 18, 2023
1 parent f77c59c commit 0321093
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,17 @@ export class Config implements IConfig {
} catch (error: any) {
final.failures.push({error: error as Error, plugin: p})
debug(error)
if (!captureErrors && error.oclif?.exit !== undefined) throw error
// Do not throw the error if
// captureErrors is set to true
// error.oclif.exit is undefined or 0
// error.code is MODULE_NOT_FOUND
if (
!captureErrors &&
error.oclif?.exit !== undefined &&
error.oclif?.exit !== 0 &&
error.code !== 'MODULE_NOT_FOUND'
)
throw error
}

marker?.addDetails({
Expand Down

0 comments on commit 0321093

Please sign in to comment.