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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 /**
2 * @license
3 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4 *
5 * This code may only be used under the BSD style license found at polymer.githu b.io/LICENSE.txt
6 * The complete set of authors may be found at polymer.github.io/AUTHORS.txt
7 * The complete set of contributors may be found at polymer.github.io/CONTRIBUTO RS.txt
8 * Code distributed by Google as part of the polymer project is also subject to
9 * an additional IP rights grant found at polymer.github.io/PATENTS.txt
10 */
11 (function(scope) {
12 'use strict';
13
14 var parse = scope.parse || require('./parsing').parse;
15 var pretty = scope.pretty || require('./formatting').pretty;
16
17 function normalize(error, prettyOptions) {
18 if (error.parsedStack) return error;
19 var message = error.message || error.description || error || '<unknown error>' ;
20 var parsedStack = [];
21 try {
22 parsedStack = parse(error.stack || error.toString());
23 } catch (error) {
24 // Ah well.
25 }
26
27 if (parsedStack.length === 0 && error.fileName) {
28 parsedStack.push({
29 method: '',
30 location: error.fileName,
31 line: error.lineNumber,
32 column: error.columnNumber,
33 });
34 }
35
36 if (!prettyOptions || !prettyOptions.showColumns) {
37 for (var i = 0, line; line = parsedStack[i]; i++) {
38 delete line.column;
39 }
40 }
41
42 var prettyStack = message;
43 if (parsedStack.length > 0) {
44 prettyStack = prettyStack + '\n' + pretty(parsedStack, prettyOptions);
45 }
46
47 var cleanErr = Object.create(Error.prototype);
48 cleanErr.message = message;
49 cleanErr.stack = prettyStack;
50 cleanErr.parsedStack = parsedStack;
51
52 return cleanErr;
53 }
54
55 scope.normalize = normalize;
56 })(typeof module !== 'undefined' ? module.exports : (this.Stacky = this.Stacky | | {}));
57
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698