OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Handles uncaught exceptions thrown by extensions. By default this is to | 5 // Handles uncaught exceptions thrown by extensions. By default this is to |
6 // log an error message, but tests may override this behaviour. | 6 // log an error message, but tests may override this behaviour. |
7 var handler = function(message, e) { | 7 var handler = function(message, e) { |
8 console.error(message); | 8 window.console.error(message); |
not at google - send to devlin
2014/10/28 16:00:41
The use of console rather than window.console here
| |
9 }; | 9 }; |
10 | 10 |
11 /** | 11 /** |
12 * Append the error description and stack trace to |message|. | 12 * Append the error description and stack trace to |message|. |
13 * | 13 * |
14 * @param {string} message - The prefix of the error message. | 14 * @param {string} message - The prefix of the error message. |
15 * @param {Error|*} e - The thrown error object. This object is potentially | 15 * @param {Error|*} e - The thrown error object. This object is potentially |
16 * unsafe, because it could be generated by an extension. | 16 * unsafe, because it could be generated by an extension. |
17 * @param {string=} priorStackTrace - The stack trace to be appended to the | 17 * @param {string=} priorStackTrace - The stack trace to be appended to the |
18 * error message. This stack trace must not include stack frames of |e.stack|, | 18 * error message. This stack trace must not include stack frames of |e.stack|, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 }; | 101 }; |
102 | 102 |
103 // |newHandler| A function which matches |handler|. | 103 // |newHandler| A function which matches |handler|. |
104 exports.setHandler = function(newHandler) { | 104 exports.setHandler = function(newHandler) { |
105 handler = newHandler; | 105 handler = newHandler; |
106 }; | 106 }; |
107 | 107 |
108 exports.getStackTrace = getStackTrace; | 108 exports.getStackTrace = getStackTrace; |
109 exports.getExtensionStackTrace = getExtensionStackTrace; | 109 exports.getExtensionStackTrace = getExtensionStackTrace; |
110 exports.safeErrorToString = safeErrorToString; | 110 exports.safeErrorToString = safeErrorToString; |
OLD | NEW |