| OLD | NEW |
| 1 # -*- coding: utf-8 -*- |
| 1 # Copyright 2010 Google Inc. All Rights Reserved. | 2 # Copyright 2010 Google Inc. All Rights Reserved. |
| 2 # | 3 # |
| 3 # Permission is hereby granted, free of charge, to any person obtaining a | 4 # Permission is hereby granted, free of charge, to any person obtaining a |
| 4 # copy of this software and associated documentation files (the | 5 # copy of this software and associated documentation files (the |
| 5 # "Software"), to deal in the Software without restriction, including | 6 # "Software"), to deal in the Software without restriction, including |
| 6 # without limitation the rights to use, copy, modify, merge, publish, dis- | 7 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 7 # tribute, sublicense, and/or sell copies of the Software, and to permit | 8 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 8 # persons to whom the Software is furnished to do so, subject to the fol- | 9 # persons to whom the Software is furnished to do so, subject to the fol- |
| 9 # lowing conditions: | 10 # lowing conditions: |
| 10 # | 11 # |
| 11 # The above copyright notice and this permission notice shall be included | 12 # The above copyright notice and this permission notice shall be included |
| 12 # in all copies or substantial portions of the Software. | 13 # in all copies or substantial portions of the Software. |
| 13 # | 14 # |
| 14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | 15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- | 16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- |
| 16 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT | 17 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT |
| 17 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | 18 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 18 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 19 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | 20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 20 # IN THE SOFTWARE. | 21 # IN THE SOFTWARE. |
| 21 | |
| 22 """gsutil exceptions. | 22 """gsutil exceptions. |
| 23 | 23 |
| 24 The exceptions in this module are for use across multiple different classes. | 24 The exceptions in this module are for use across multiple different classes. |
| 25 """ | 25 """ |
| 26 | 26 |
| 27 from __future__ import absolute_import |
| 28 |
| 27 | 29 |
| 28 class AbortException(StandardError): | 30 class AbortException(StandardError): |
| 29 """Exception raised when a user aborts a command that needs to do cleanup.""" | 31 """Exception raised when a user aborts a command that needs to do cleanup.""" |
| 30 | 32 |
| 31 def __init__(self, reason): | 33 def __init__(self, reason): |
| 32 StandardError.__init__(self) | 34 StandardError.__init__(self) |
| 33 self.reason = reason | 35 self.reason = reason |
| 34 | 36 |
| 35 def __repr__(self): | 37 def __repr__(self): |
| 36 return 'AbortException: %s' % self.reason | 38 return 'AbortException: %s' % self.reason |
| (...skipping 16 matching lines...) Expand all Loading... |
| 53 | 55 |
| 54 Args: | 56 Args: |
| 55 reason: Text describing the problem. | 57 reason: Text describing the problem. |
| 56 informational: Indicates reason should be printed as FYI, not a failure. | 58 informational: Indicates reason should be printed as FYI, not a failure. |
| 57 """ | 59 """ |
| 58 StandardError.__init__(self) | 60 StandardError.__init__(self) |
| 59 self.reason = reason | 61 self.reason = reason |
| 60 self.informational = informational | 62 self.informational = informational |
| 61 | 63 |
| 62 def __repr__(self): | 64 def __repr__(self): |
| 63 return 'CommandException: %s' % self.reason | 65 return str(self) |
| 64 | 66 |
| 65 def __str__(self): | 67 def __str__(self): |
| 66 return 'CommandException: %s' % self.reason | 68 return 'CommandException: %s' % self.reason |
| 67 | 69 |
| 68 | 70 |
| 69 class ProjectIdException(StandardError): | 71 class InvalidUrlError(Exception): |
| 72 """Exception raised when URL is invalid.""" |
| 70 | 73 |
| 71 def __init__(self, reason): | 74 def __init__(self, message): |
| 72 StandardError.__init__(self) | 75 Exception.__init__(self, message) |
| 73 self.reason = reason | 76 self.message = message |
| 74 | 77 |
| 75 def __repr__(self): | 78 def __repr__(self): |
| 76 return 'ProjectIdException: %s' % self.reason | 79 return str(self) |
| 77 | 80 |
| 78 def __str__(self): | 81 def __str__(self): |
| 79 return 'ProjectIdException: %s' % self.reason | 82 return 'InvalidUrlError: %s' % self.message |
| OLD | NEW |