| OLD | NEW |
| 1 # Copyright 2010 Google Inc. | 1 # Copyright 2010 Google Inc. |
| 2 # | 2 # |
| 3 # Permission is hereby granted, free of charge, to any person obtaining a | 3 # Permission is hereby granted, free of charge, to any person obtaining a |
| 4 # copy of this software and associated documentation files (the | 4 # copy of this software and associated documentation files (the |
| 5 # "Software"), to deal in the Software without restriction, including | 5 # "Software"), to deal in the Software without restriction, including |
| 6 # without limitation the rights to use, copy, modify, merge, publish, dis- | 6 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 7 # tribute, sublicense, and/or sell copies of the Software, and to permit | 7 # 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- | 8 # persons to whom the Software is furnished to do so, subject to the fol- |
| 9 # lowing conditions: | 9 # lowing conditions: |
| 10 # | 10 # |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 This exception should be used to signal user errors or system failures | 28 This exception should be used to signal user errors or system failures |
| 29 (like timeouts), not bugs (like an incorrect param value). For the | 29 (like timeouts), not bugs (like an incorrect param value). For the |
| 30 latter you should raise Exception so we can see where/how it happened | 30 latter you should raise Exception so we can see where/how it happened |
| 31 via gsutil -D (which will include a stack trace for raised Exceptions). | 31 via gsutil -D (which will include a stack trace for raised Exceptions). |
| 32 """ | 32 """ |
| 33 | 33 |
| 34 def __init__(self, reason, informational=False): | 34 def __init__(self, reason, informational=False): |
| 35 """Instantiate a CommandException. | 35 """Instantiate a CommandException. |
| 36 | 36 |
| 37 Args: | 37 Args: |
| 38 reason: text describing the problem. | 38 reason: Text describing the problem. |
| 39 informational: indicates reason should be printed as FYI, not a failure. | 39 informational: Indicates reason should be printed as FYI, not a failure. |
| 40 """ | 40 """ |
| 41 StandardError.__init__(self) | 41 StandardError.__init__(self) |
| 42 self.reason = reason | 42 self.reason = reason |
| 43 self.informational = informational | 43 self.informational = informational |
| 44 | 44 |
| 45 def __repr__(self): | 45 def __repr__(self): |
| 46 return 'CommandException: %s' % self.reason | 46 return 'CommandException: %s' % self.reason |
| 47 | 47 |
| 48 def __str__(self): | 48 def __str__(self): |
| 49 return 'CommandException: %s' % self.reason | 49 return 'CommandException: %s' % self.reason |
| 50 | 50 |
| 51 | 51 |
| 52 class ProjectIdException(StandardError): | 52 class ProjectIdException(StandardError): |
| 53 | 53 |
| 54 def __init__(self, reason): | 54 def __init__(self, reason): |
| 55 StandardError.__init__(self) | 55 StandardError.__init__(self) |
| 56 self.reason = reason | 56 self.reason = reason |
| 57 | 57 |
| 58 def __repr__(self): | 58 def __repr__(self): |
| 59 return 'ProjectIdException: %s' % self.reason | 59 return 'ProjectIdException: %s' % self.reason |
| 60 | 60 |
| 61 def __str__(self): | 61 def __str__(self): |
| 62 return 'ProjectIdException: %s' % self.reason | 62 return 'ProjectIdException: %s' % self.reason |
| OLD | NEW |