nikademus79 / psutil

Automatically exported from code.google.com/p/psutil
Other
0 stars 0 forks source link

Provide a more detailed exception string #113

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Run some script and make it raise NoSuchProcess or AccessDenied exception.
Example:

proc = subprocess.Popen('input', shell=1)
p = psutil.Process(proc.pid)
p.name
proc.kill()
proc.wait()
print p.get_children()

What is the expected output? What do you see instead?
The exception string will look like: 

"psutil.error.NoSuchProcess: process no longer exists" 

This message is pretty anonymous and doesn't give any information about the 
process which caused the exception.
This is particularly painful if the error suddenly occurs when running a 
program which iterates over multiple processes.
When this happens it would be helpful for debugging to know *what* process 
caused the exception, by providing at least its PID and, if available, its name.
Possible variants:

"psutil.error.NoSuchProcess: process no longer exists (pid=100)"
"psutil.error.NoSuchProcess: process no longer exists (pid=100, name='python')"
"psutil.error.AccessDenied: (pid=100)"
"psutil.error.AccessDenied: (pid=100, name='python')"

Original issue reported on code.google.com by g.rodola on 7 Oct 2010 at 10:16

GoogleCodeExporter commented 8 years ago
This is now implemented in r653 in which I also added a "name" 
attribute/parameter to exception classes.

Original comment by g.rodola on 7 Oct 2010 at 11:26

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Updated csets after the SVN -> Mercurial migration:
r653 == revision b831493c0659

Original comment by g.rodola on 2 Mar 2013 at 11:54