added custom exception type

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@26103 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2010-01-19 21:03:07 +00:00
1 parent dc6db9328b
commit 2004958ec0
2 files changed
+27 -1

No files matched your search

+1 -1
View File
@@ -31,7 +31,7 @@ public class PosixAPI {
private static final POSIX posix = POSIXFactory.getPOSIX(new POSIXHandler() {
public void error(ERRORS errors, String s) {
throw new RuntimeException(s+" "+errors);
throw new PosixException(s,errors);
}
public void unimplementedError(String s) {
@@ -0,0 +1,26 @@
package hudson.os;
import org.jruby.ext.posix.POSIX.ERRORS;
/**
* Indicates an error during POSIX API call.
*
* @author Kohsuke Kawaguchi
*/
public class PosixException extends RuntimeException {
private final ERRORS errors;
public PosixException(String message, ERRORS errors) {
super(message);
this.errors = errors;
}
public ERRORS getErrorCode() {
return errors;
}
@Override
public String toString() {
return super.toString()+" "+errors;
}
}