| 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 | 7 |
| 8 var handler = function(message, e) { | 8 var handler = function(message, e) { |
| 9 console.error(message); | 9 console.error(message); |
| 10 }; | 10 }; |
| 11 | 11 |
| 12 // |message| The message associated with the error. | 12 // |message| The message associated with the error. |
| 13 // |e| The object that was thrown. | 13 // |e| The object that was thrown. |
| 14 exports.handle = function(message, e) { | 14 exports.handle = function(message, e) { |
| 15 handler(message, e); | 15 handler(message, e); |
| 16 }; | 16 }; |
| 17 | 17 |
| 18 // |newHandler| A function which matches |exports.handle|. | 18 // |newHandler| A function which matches |exports.handle|. |
| 19 exports.setHandler = function(newHandler) { | 19 exports.setHandler = function(newHandler) { |
| 20 handler = newHandler; | 20 handler = newHandler; |
| 21 }; | 21 }; |
| OLD | NEW |