Include errno name in error messages, if the errno is known.

This commit is contained in:
Adam Murdoch
2013-02-16 11:14:41 +11:00
parent 0c5d0dfe80
commit 01c4f26e97
7 changed files with 26 additions and 13 deletions

View File

@@ -19,10 +19,12 @@ package net.rubygrapefruit.platform.internal;
public class FunctionResult {
String message;
int errno;
private String errorCodeDescription;
void failed(String message, int errno) {
void failed(String message, int errno, String errorCodeDescription) {
this.message = message;
this.errno = errno;
this.errorCodeDescription = errorCodeDescription;
}
void failed(String message) {
@@ -34,6 +36,9 @@ public class FunctionResult {
}
public String getMessage() {
if (errorCodeDescription != null) {
return String.format("%s (%s errno %d)", message, errorCodeDescription, errno);
}
if (errno != 0) {
return String.format("%s (errno %d)", message, errno);
}

View File

@@ -20,7 +20,7 @@ import net.rubygrapefruit.platform.internal.FunctionResult;
import net.rubygrapefruit.platform.internal.MutableSystemInfo;
public class NativeLibraryFunctions {
public static final int VERSION = 13;
public static final int VERSION = 14;
public static native int getVersion();