catch setDiskLabel error

This commit is contained in:
Djeeberjr 2023-01-27 13:50:51 +01:00
parent 916831743e
commit f6c0feda4b

View File

@ -51,8 +51,13 @@ class Drive implements IPeripheral {
this.native.setDiskLabel(); this.native.setDiskLabel();
} }
public inline function setDiskLabel(label: String) { public inline function setDiskLabel(label: String): Null<Error> {
this.native.setDiskLabel(label); try {
this.native.setDiskLabel(label);
return null;
} catch (e: Dynamic) {
return new Error("Invalid label");
}
} }
public inline function hasData():Bool { public inline function hasData():Bool {