OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import posixpath | 5 import posixpath |
6 import traceback | 6 import traceback |
7 | 7 |
8 from future import Future | 8 from future import Future |
9 from path_util import ( | 9 from path_util import ( |
10 AssertIsDirectory, AssertIsValid, IsDirectory, IsValid, SplitParent, | 10 AssertIsDirectory, AssertIsValid, IsDirectory, IsValid, SplitParent, |
11 ToDirectory) | 11 ToDirectory) |
12 | 12 |
13 | 13 |
| 14 def IsFileSystemThrottledError(error): |
| 15 return type(error).__name__ == 'FileSystemThrottledError' |
| 16 |
| 17 |
14 class _BaseFileSystemException(Exception): | 18 class _BaseFileSystemException(Exception): |
15 def __init__(self, message): | 19 def __init__(self, message): |
16 Exception.__init__(self, message) | 20 Exception.__init__(self, message) |
17 | 21 |
18 @classmethod | 22 @classmethod |
19 def RaiseInFuture(cls, message): | 23 def RaiseInFuture(cls, message): |
20 stack = traceback.format_stack() | 24 stack = traceback.format_stack() |
21 def boom(): raise cls('%s. Creation stack:\n%s' % (message, ''.join(stack))) | 25 def boom(): raise cls('%s. Creation stack:\n%s' % (message, ''.join(stack))) |
22 return Future(callback=boom) | 26 return Future(callback=boom) |
23 | 27 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 self.GetIdentity() == other.GetIdentity()) | 222 self.GetIdentity() == other.GetIdentity()) |
219 | 223 |
220 def __ne__(self, other): | 224 def __ne__(self, other): |
221 return not (self == other) | 225 return not (self == other) |
222 | 226 |
223 def __repr__(self): | 227 def __repr__(self): |
224 return '<%s>' % type(self).__name__ | 228 return '<%s>' % type(self).__name__ |
225 | 229 |
226 def __str__(self): | 230 def __str__(self): |
227 return repr(self) | 231 return repr(self) |
OLD | NEW |