Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: third_party/gsutil/gslib/exception.py

Issue 1377933002: [catapult] - Copy Telemetry's gsutilz over to third_party. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Rename to gsutil. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/gsutil/gslib/devshell_auth_plugin.py ('k') | third_party/gsutil/gslib/file_part.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # -*- coding: utf-8 -*-
2 # Copyright 2010 Google Inc. All Rights Reserved.
3 #
4 # Permission is hereby granted, free of charge, to any person obtaining a
5 # copy of this software and associated documentation files (the
6 # "Software"), to deal in the Software without restriction, including
7 # without limitation the rights to use, copy, modify, merge, publish, dis-
8 # tribute, sublicense, and/or sell copies of the Software, and to permit
9 # persons to whom the Software is furnished to do so, subject to the fol-
10 # lowing conditions:
11 #
12 # The above copyright notice and this permission notice shall be included
13 # in all copies or substantial portions of the Software.
14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
17 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
18 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 # IN THE SOFTWARE.
22 """gsutil exceptions.
23
24 The exceptions in this module are for use across multiple different classes.
25 """
26
27 from __future__ import absolute_import
28
29
30 class AbortException(StandardError):
31 """Exception raised when a user aborts a command that needs to do cleanup."""
32
33 def __init__(self, reason):
34 StandardError.__init__(self)
35 self.reason = reason
36
37 def __repr__(self):
38 return 'AbortException: %s' % self.reason
39
40 def __str__(self):
41 return 'AbortException: %s' % self.reason
42
43
44 class CommandException(StandardError):
45 """Exception raised when a problem is encountered running a gsutil command.
46
47 This exception should be used to signal user errors or system failures
48 (like timeouts), not bugs (like an incorrect param value). For the
49 latter you should raise Exception so we can see where/how it happened
50 via gsutil -D (which will include a stack trace for raised Exceptions).
51 """
52
53 def __init__(self, reason, informational=False):
54 """Instantiate a CommandException.
55
56 Args:
57 reason: Text describing the problem.
58 informational: Indicates reason should be printed as FYI, not a failure.
59 """
60 StandardError.__init__(self)
61 self.reason = reason
62 self.informational = informational
63
64 def __repr__(self):
65 return str(self)
66
67 def __str__(self):
68 return 'CommandException: %s' % self.reason
69
70
71 class HashMismatchException(Exception):
72 """Exception raised when data integrity validation fails."""
73 pass
74
75
76 class InvalidUrlError(Exception):
77 """Exception raised when URL is invalid."""
78
79 def __init__(self, message):
80 Exception.__init__(self, message)
81 self.message = message
82
83 def __repr__(self):
84 return str(self)
85
86 def __str__(self):
87 return 'InvalidUrlError: %s' % self.message
OLDNEW
« no previous file with comments | « third_party/gsutil/gslib/devshell_auth_plugin.py ('k') | third_party/gsutil/gslib/file_part.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698