mirror of https://github.com/status-im/metro.git
Improve Metro's TransformError message for transform errors.
Reviewed By: davidaurelio Differential Revision: D5470538 fbshipit-source-id: dea3e798c26964bb789917e73bb06a7629af7aa4
This commit is contained in:
parent
ce0da03a05
commit
521e25bded
|
@ -204,7 +204,6 @@ function formatGenericError(err, filename) {
|
|||
var msg = 'TransformError: ' + filename + ': ' + err.message;
|
||||
var error = new TransformError();
|
||||
var stack = (err.stack || '').split('\n').slice(0, -1);
|
||||
stack.push(msg);
|
||||
error.stack = stack.join('\n');
|
||||
error.message = msg;
|
||||
error.type = 'TransformError';
|
||||
|
|
|
@ -269,21 +269,21 @@ class TerminalReporter {
|
|||
return;
|
||||
}
|
||||
|
||||
let message = (error.snippet == null && error.stack != null)
|
||||
? error.stack
|
||||
//$FlowFixMe T19379628
|
||||
let message = error.message;
|
||||
: error.message;
|
||||
//$FlowFixMe T19379628
|
||||
if (error.filename && !message.includes(error.filename)) {
|
||||
//$FlowFixMe T19379628
|
||||
message += ` [${error.filename}]`;
|
||||
}
|
||||
|
||||
let str = JSON.stringify(message);
|
||||
if (error.snippet != null) {
|
||||
//$FlowFixMe T19379628
|
||||
str += '\n' + error.snippet;
|
||||
message += '\n' + error.snippet;
|
||||
}
|
||||
|
||||
this._logBundlingErrorMessage(str);
|
||||
this._logBundlingErrorMessage(message);
|
||||
}
|
||||
|
||||
_logBundlingErrorMessage(message: string) {
|
||||
|
|
Loading…
Reference in New Issue