Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
general: app.register throws with original module error
- Loading branch information
Showing
6 changed files
with
53 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* | ||
* @param {function} path | ||
* @returns {*} | ||
* @throws {Error} | ||
*/ | ||
function requireWithSkippingOfMissedModuleError(path) { | ||
try { | ||
return require(path); | ||
} catch (error) { | ||
if ( | ||
error instanceof Error && | ||
error.code === 'MODULE_NOT_FOUND' | ||
) { | ||
return undefined; | ||
} else { | ||
throw error; | ||
} | ||
} | ||
} | ||
|
||
module.exports = requireWithSkippingOfMissedModuleError; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var 123some_syntax_error; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters