Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(665)

Unified Diff: ui/file_manager/file_manager/common/js/importer_common.js

Issue 1005693008: Files.app: Improve importer error catcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/common/js/importer_common.js
diff --git a/ui/file_manager/file_manager/common/js/importer_common.js b/ui/file_manager/file_manager/common/js/importer_common.js
index c03b8237506b776c94dcfa996edae7f8ee4dfbdf..8e9cd7252137c7bf990a72755a41e773c56e4c9f 100644
--- a/ui/file_manager/file_manager/common/js/importer_common.js
+++ b/ui/file_manager/file_manager/common/js/importer_common.js
@@ -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);
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698