From c625d0227941e5c71b9b9893d5dcfffdc9987006 Mon Sep 17 00:00:00 2001 From: Peter Flynn Date: Thu, 4 Dec 2014 17:33:37 -0800 Subject: [PATCH] Refinement of PR #8736: also log LESS errors from the parsing stage to the console (not just the output stage). Also covers cases where the file doesn't exist, for both CSS & LESS. --- src/utils/ExtensionUtils.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utils/ExtensionUtils.js b/src/utils/ExtensionUtils.js index 67298d60719..cf0e6d96871 100644 --- a/src/utils/ExtensionUtils.js +++ b/src/utils/ExtensionUtils.js @@ -125,7 +125,6 @@ define(function (require, exports, module) { try { result.resolve(tree.toCSS()); } catch (toCSSError) { - console.error(toCSSError.filename + ":" + toCSSError.line + " " + toCSSError.message); result.reject(toCSSError); } } @@ -220,6 +219,16 @@ define(function (require, exports, module) { }) .fail(result.reject); + // Summarize error info to console for easier debugging + result.fail(function (error, textStatus, httpError) { + if (error.readyState !== undefined) { + // If first arg is a jQXHR object, the real error info is in the next two args + console.error("[Extension] Unable to read stylesheet " + path + ":", textStatus, httpError); + } else { + console.error("[Extension] Unable to process stylesheet " + path, error); + } + }); + return result.promise(); }