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

Unified Diff: third_party/psutil/psutil/error.py

Issue 6246123: Moving psutil to third_party. This is first step for Media Performance test project. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: modification based on code review's comments Created 9 years, 11 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
« no previous file with comments | « third_party/psutil/psutil/compat.py ('k') | third_party/psutil/setup.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/psutil/psutil/error.py
diff --git a/third_party/psutil/psutil/error.py b/third_party/psutil/psutil/error.py
new file mode 100644
index 0000000000000000000000000000000000000000..214a241b993af1ac39b32a8ef4e9c3a156eada8a
--- /dev/null
+++ b/third_party/psutil/psutil/error.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+#
+# $Id: error.py 744 2010-10-27 22:42:42Z jloden $
+#
+
+"""psutil exception classes"""
+
+
+class Error(Exception):
+ """Base exception class. All other psutil exceptions inherit
+ from this one.
+ """
+
+class NoSuchProcess(Error):
+ """Exception raised when a process with a certain PID doesn't
+ or no longer exists (zombie).
+ """
+
+ def __init__(self, pid, name=None, msg=None):
+ self.pid = pid
+ self.name = name
+ self.msg = msg
+ if msg is None:
+ if name:
+ details = "(pid=%s, name=%s)" % (self.pid, repr(self.name))
+ else:
+ details = "(pid=%s)" % self.pid
+ self.msg = "process no longer exists " + details
+
+ def __str__(self):
+ return self.msg
+
+
+class AccessDenied(Error):
+ """Exception raised when permission to perform an action is denied."""
+
+ def __init__(self, pid=None, name=None, msg=None):
+ self.pid = pid
+ self.name = name
+ self.msg = msg
+ if msg is None:
+ if (pid is not None) and (name is not None):
+ self.msg = "(pid=%s, name=%s)" % (pid, repr(name))
+ elif (pid is not None):
+ self.msg = "(pid=%s)" % self.pid
+ else:
+ self.msg = ""
+
+ def __str__(self):
+ return self.msg
+
« no previous file with comments | « third_party/psutil/psutil/compat.py ('k') | third_party/psutil/setup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698