OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 # DESCRIPTION : |
| 6 # |
| 7 # This library provides mocked exception classes that replace all newline |
| 8 # characters with "<br/>" so that the factory log is easier to parse. |
| 9 |
| 10 from autotest_lib.client.common_lib import error |
| 11 |
| 12 _glob = globals() |
| 13 for _name in error.__all__: |
| 14 _thing = error.__dict__[_name] |
| 15 if isinstance(_thing, type) and issubclass(_thing, Exception): |
| 16 _str = lambda self: _thing.__str__(self).replace('\n', '<br/>') |
| 17 _glob[_name] = type(_name, (_thing,), dict(__str__=_str)) |
| 18 else: |
| 19 _glob[_name] = _thing |
| 20 |
| 21 __all__ = error.__all__ |
OLD | NEW |