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

Unified Diff: tools/telemetry/third_party/rope/rope/base/exceptions.py

Issue 1132103009: Example of refactoring using rope library. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/third_party/rope/rope/base/exceptions.py
diff --git a/tools/telemetry/third_party/rope/rope/base/exceptions.py b/tools/telemetry/third_party/rope/rope/base/exceptions.py
new file mode 100644
index 0000000000000000000000000000000000000000..d161c89ed688cd463434c6882566f12299853cf4
--- /dev/null
+++ b/tools/telemetry/third_party/rope/rope/base/exceptions.py
@@ -0,0 +1,61 @@
+class RopeError(Exception):
+ """Base exception for rope"""
+
+
+class ResourceNotFoundError(RopeError):
+ """Resource not found exception"""
+
+
+class RefactoringError(RopeError):
+ """Errors for performing a refactoring"""
+
+
+class InterruptedTaskError(RopeError):
+ """The task has been interrupted"""
+
+
+class HistoryError(RopeError):
+ """Errors for history undo/redo operations"""
+
+
+class ModuleNotFoundError(RopeError):
+ """Module not found exception"""
+
+
+class AttributeNotFoundError(RopeError):
+ """Attribute not found exception"""
+
+
+class NameNotFoundError(RopeError):
+ """Name not found exception"""
+
+
+class BadIdentifierError(RopeError):
+ """The name cannot be resolved"""
+
+
+class ModuleSyntaxError(RopeError):
+ """Module has syntax errors
+
+ The `filename` and `lineno` fields indicate where the error has
+ occurred.
+
+ """
+
+ def __init__(self, filename, lineno, message):
+ self.filename = filename
+ self.lineno = lineno
+ self.message_ = message
+ super(ModuleSyntaxError, self).__init__(
+ 'Syntax error in file <%s> line <%s>: %s' %
+ (filename, lineno, message))
+
+
+class ModuleDecodeError(RopeError):
+ """Cannot decode module"""
+
+ def __init__(self, filename, message):
+ self.filename = filename
+ self.message_ = message
+ super(ModuleDecodeError, self).__init__(
+ 'Cannot decode file <%s>: %s' % (filename, message))
« no previous file with comments | « tools/telemetry/third_party/rope/rope/base/evaluate.py ('k') | tools/telemetry/third_party/rope/rope/base/fscommands.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698