more context incase of error

This commit is contained in:
Doug MacEachern 2006-03-04 07:28:15 +00:00
parent c91d0991ad
commit 9fa41cc1c7
1 changed files with 11 additions and 3 deletions

View File

@ -27,12 +27,20 @@ public class SigarProcess implements SigarProcessMBean {
this.sigarImpl.close();
}
private RuntimeException unexpectedError(String type,
SigarException e) {
String msg =
"Unexected error in Sigar.get" + type +
": " + e.getMessage();
return new IllegalArgumentException(msg);
}
private synchronized ProcMem getMem() {
try {
long pid = this.sigar.getPid();
return this.sigar.getProcMem(pid);
} catch (SigarException e) {
throw new IllegalArgumentException();
throw unexpectedError("Mem", e);
}
}
@ -41,7 +49,7 @@ public class SigarProcess implements SigarProcessMBean {
long pid = this.sigar.getPid();
return this.sigar.getProcTime(pid);
} catch (SigarException e) {
throw new IllegalArgumentException();
throw unexpectedError("Time", e);
}
}
@ -50,7 +58,7 @@ public class SigarProcess implements SigarProcessMBean {
long pid = this.sigar.getPid();
return this.sigar.getProcFd(pid);
} catch (SigarException e) {
throw new IllegalArgumentException();
throw unexpectedError("Fd", e);
}
}