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

Unified Diff: appengine/config_service/ui/bower_components/stacky/lib/normalization.js

Issue 2923973003: Added base template for config ui. (Closed)
Patch Set: Created 3 years, 6 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
Index: appengine/config_service/ui/bower_components/stacky/lib/normalization.js
diff --git a/appengine/config_service/ui/bower_components/stacky/lib/normalization.js b/appengine/config_service/ui/bower_components/stacky/lib/normalization.js
new file mode 100644
index 0000000000000000000000000000000000000000..ac3bb92ec9f1a4bc44e3cdf6092214606f47ec8f
--- /dev/null
+++ b/appengine/config_service/ui/bower_components/stacky/lib/normalization.js
@@ -0,0 +1,57 @@
+/**
+ * @license
+ * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
+ *
+ * This code may only be used under the BSD style license found at polymer.github.io/LICENSE.txt
+ * The complete set of authors may be found at polymer.github.io/AUTHORS.txt
+ * The complete set of contributors may be found at polymer.github.io/CONTRIBUTORS.txt
+ * Code distributed by Google as part of the polymer project is also subject to
+ * an additional IP rights grant found at polymer.github.io/PATENTS.txt
+ */
+(function(scope) {
+'use strict';
+
+var parse = scope.parse || require('./parsing').parse;
+var pretty = scope.pretty || require('./formatting').pretty;
+
+function normalize(error, prettyOptions) {
+ if (error.parsedStack) return error;
+ var message = error.message || error.description || error || '<unknown error>';
+ var parsedStack = [];
+ try {
+ parsedStack = parse(error.stack || error.toString());
+ } catch (error) {
+ // Ah well.
+ }
+
+ if (parsedStack.length === 0 && error.fileName) {
+ parsedStack.push({
+ method: '',
+ location: error.fileName,
+ line: error.lineNumber,
+ column: error.columnNumber,
+ });
+ }
+
+ if (!prettyOptions || !prettyOptions.showColumns) {
+ for (var i = 0, line; line = parsedStack[i]; i++) {
+ delete line.column;
+ }
+ }
+
+ var prettyStack = message;
+ if (parsedStack.length > 0) {
+ prettyStack = prettyStack + '\n' + pretty(parsedStack, prettyOptions);
+ }
+
+ var cleanErr = Object.create(Error.prototype);
+ cleanErr.message = message;
+ cleanErr.stack = prettyStack;
+ cleanErr.parsedStack = parsedStack;
+
+ return cleanErr;
+}
+
+scope.normalize = normalize;
+})(typeof module !== 'undefined' ? module.exports : (this.Stacky = this.Stacky || {}));
+

Powered by Google App Engine
This is Rietveld 408576698