Commit 128fddc8 authored by kenobi's avatar kenobi Committed by Commit bot

Files.app: Improve importer error catcher.

- Fix a bug where stacks weren't getting printed.
- Remove throwing of errors - the error catcher should catch but not re-throw errors.

BUG=None

Review URL: https://codereview.chromium.org/1005693008

Cr-Commit-Position: refs/heads/master@{#321880}
parent 09f8f2a7
......@@ -756,23 +756,21 @@ importer.RuntimeLogger.prototype.error = function(content) {
/** @override */
importer.RuntimeLogger.prototype.catcher = function(context) {
var prefix = '(' + context + ') ';
return function(error) {
this.reportErrorContext_(context);
var message = prefix + 'Caught error in promise chain.';
// Append error info, if provided, then output the error.
if (error) {
// Error can be anything...maybe an Error, maybe a string.
var error = error.message || error;
this.error(message + ' Error: ' + error);
if (error.stack) {
this.write_('STACK', prefix + error.stack);
}
} else {
this.error(message);
error = new Error(message);
message += ' Error: ' + error.message || error;
}
this.error(message);
throw error;
// Output a stack, if provided.
if (error && error.stack) {
this.write_('STACK', prefix + error.stack);
}
}.bind(this);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment