Chromium Code Reviews| Index: tools/deep_memory_profiler/lib/exception.py |
| diff --git a/tools/deep_memory_profiler/lib/exception.py b/tools/deep_memory_profiler/lib/exception.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6b564df94c7564e743a910a15b58e625eee4656a |
| --- /dev/null |
| +++ b/tools/deep_memory_profiler/lib/exception.py |
| @@ -0,0 +1,34 @@ |
| +# Copyright 2013 The Chromium Authors. All rights reserved. |
|
M-A Ruel
2013/07/16 13:31:32
Maybe name it exceptions.py ?
Dai Mikurube (NOT FULLTIME)
2013/07/17 05:55:06
Done.
|
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +class EmptyDumpException(Exception): |
| + def __init__(self, value=''): |
| + super(EmptyDumpException, self).__init__() |
|
M-A Ruel
2013/07/16 13:31:32
Just FYI, you could go simpler with:
class EmptyD
Dai Mikurube (NOT FULLTIME)
2013/07/17 05:55:06
Done.
|
| + self.value = value |
| + def __str__(self): |
| + return repr(self.value) |
| + |
| + |
| +class ParsingException(Exception): |
| + def __init__(self, value=''): |
| + super(ParsingException, self).__init__() |
| + self.value = value |
| + def __str__(self): |
| + return repr(self.value) |
| + |
| + |
| +class InvalidDumpException(ParsingException): |
| + def __init__(self, value): |
| + super(InvalidDumpException, self).__init__() |
| + self.value = value |
| + def __str__(self): |
| + return "invalid heap profile dump: %s" % repr(self.value) |
| + |
| + |
| +class ObsoleteDumpVersionException(ParsingException): |
| + def __init__(self, value): |
| + super(ObsoleteDumpVersionException, self).__init__() |
| + self.value = value |
| + def __str__(self): |
| + return "obsolete heap profile dump version: %s" % repr(self.value) |