Skip to content

Commit

Permalink
include underlying error in could not load
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLudd committed Feb 7, 2020
1 parent 475a6d5 commit 43c6b78
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/could-not-load.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ createMessage = (base, module, callers) ->
, []

class CouldNotLoad extends Error
constructor: (@base, @module, @callers) ->
constructor: (@base, @module, @callers, @underlyingError) ->
places = createMessage(@base, @module, @callers)
@message = "Could not load module #{@module}. Tried in these places:\n#{places.join(',\n')}"

Expand Down
2 changes: 1 addition & 1 deletion lib/find-module.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tryFind = (base, fileName, callers) ->
try
findModule(base, fileName, callers)
catch e2
throw new CouldNotLoad base, fileName, callers
throw new CouldNotLoad base, fileName, callers, e2
else
instance: {}
path: makePath base, fileName, callers
Expand Down

0 comments on commit 43c6b78

Please sign in to comment.