scoop:scoop.platform:0.1.0
src/io/native_errors.scoop
Selected production source · src/io/native_errors.scoop
1
package scoop.platform.io3
import scoop.platform.system.*5
internal fun failNative(operation: String, code: Int, context: OsString? = None): Nothing {6
val error = NativeError(NativeErrorDomain.PosixErrno, code)7
throw PlatformException(operation, error.kind, Some(error), context)8
}10
internal fun checkNative(11
value: Long,12
code: Int,13
operation: String,14
context: OsString? = None15
): Long {16
if (value < 0L)17
failNative(operation, code, context)18
return value19
}21
internal fun checkNativeStatus(22
value: Int,23
code: Int,24
operation: String,25
context: OsString? = None26
) {27
if (value < 0)28
failNative(operation, code, context)29
}