Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a more detailed exception string #113

Closed
giampaolo opened this issue May 23, 2014 · 2 comments
Closed

Provide a more detailed exception string #113

giampaolo opened this issue May 23, 2014 · 2 comments

Comments

@giampaolo
Copy link
Owner

From g.rodola on October 08, 2010 00:16:44

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: http://code.google.com/p/psutil/issues/detail?id=113

@giampaolo giampaolo self-assigned this May 23, 2014
@giampaolo
Copy link
Owner Author

From g.rodola on October 07, 2010 16:26:34

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

Status: Fixed
Labels: -Progress-0in4

@giampaolo
Copy link
Owner Author

From g.rodola on March 02, 2013 03:54:54

Updated csets after the SVN -> Mercurial migration: r653 == revision b831493c0659

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant