Use verbose module name when requiring module that errored

Summary: When requiring a module that has previously errored, the implementation of `require` only used the numerical module ID. In this diff, we enable usage of the verbose module name if present.

Reviewed By: bestander

Differential Revision: D4737723

fbshipit-source-id: 1c2d3906435a637f3e440e57f904489d84495bd2
This commit is contained in:
David Aurelio 2017-03-20 08:24:31 -07:00 committed by Facebook Github Bot
parent f19e5215cf
commit e5197e940e
1 changed files with 2 additions and 1 deletions

View File

@ -202,7 +202,8 @@ function unknownModuleError(id) {
} }
function moduleThrewError(id) { function moduleThrewError(id) {
return Error('Requiring module "' + id + '", which threw an exception.'); const displayName = __DEV__ && modules[id] && modules[id].verboseName || id;
return Error('Requiring module "' + displayName + '", which threw an exception.');
} }
if (__DEV__) { if (__DEV__) {