- Added support for setting the terminal foreground color.
- Some improvements to error handling.
This commit is contained in:
@@ -1,17 +1,26 @@
|
||||
package net.rubygrapefruit.platform.internal;
|
||||
|
||||
public class FunctionResult {
|
||||
String message;
|
||||
int errno;
|
||||
|
||||
void failed(int errno) {
|
||||
void failed(String message, int errno) {
|
||||
this.message = message;
|
||||
this.errno = errno;
|
||||
}
|
||||
|
||||
public boolean isFailed() {
|
||||
return errno != 0;
|
||||
void failed(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getErrno() {
|
||||
return errno;
|
||||
public boolean isFailed() {
|
||||
return message != null;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
if (errno != 0) {
|
||||
return String.format("%s (errno %d)", message, errno);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user