Scoop API

scoop:scoop.platform:0.1.0

src/io/native_errors.scoop

Selected production source · src/io/native_errors.scoop

1package scoop.platform.io
3import scoop.platform.system.*
5internal 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}
10internal fun checkNative(
11 value: Long,
12 code: Int,
13 operation: String,
14 context: OsString? = None
15): Long {
16 if (value < 0L)
17 failNative(operation, code, context)
18 return value
21internal fun checkNativeStatus(
22 value: Int,
23 code: Int,
24 operation: String,
25 context: OsString? = None
26) {
27 if (value < 0)
28 failNative(operation, code, context)