Skip to content

[wasm] Port NSError.swift for WASI #4879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions Sources/Foundation/NSError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ extension POSIXError {
/// Bad address.
public static var EFAULT: POSIXError.Code { return .EFAULT }

#if !os(Windows)
#if !os(Windows) && !os(WASI)
/// Block device required.
public static var ENOTBLK: POSIXError.Code { return .ENOTBLK }
#endif
Expand Down Expand Up @@ -1141,18 +1141,22 @@ extension POSIXError {
/// Protocol not supported.
public static var EPROTONOSUPPORT: POSIXError.Code { return .EPROTONOSUPPORT }

#if !os(WASI)
/// Socket type not supported.
public static var ESOCKTNOSUPPORT: POSIXError.Code { return .ESOCKTNOSUPPORT }
#endif
#endif

#if canImport(Darwin)
/// Operation not supported.
public static var ENOTSUP: POSIXError.Code { return .ENOTSUP }
#endif

#if !os(Windows)
#if !os(WASI)
/// Protocol family not supported.
public static var EPFNOSUPPORT: POSIXError.Code { return .EPFNOSUPPORT }
#endif

/// Address family not supported by protocol family.
public static var EAFNOSUPPORT: POSIXError.Code { return .EAFNOSUPPORT }
Expand Down Expand Up @@ -1191,11 +1195,13 @@ extension POSIXError {
/// Socket is not connected.
public static var ENOTCONN: POSIXError.Code { return .ENOTCONN }

#if !os(WASI)
/// Can't send after socket shutdown.
public static var ESHUTDOWN: POSIXError.Code { return .ESHUTDOWN }

/// Too many references: can't splice.
public static var ETOOMANYREFS: POSIXError.Code { return .ETOOMANYREFS }
#endif

/// Operation timed out.
public static var ETIMEDOUT: POSIXError.Code { return .ETIMEDOUT }
Expand All @@ -1211,8 +1217,10 @@ extension POSIXError {
public static var ENAMETOOLONG: POSIXError.Code { return .ENAMETOOLONG }

#if !os(Windows)
#if !os(WASI)
/// Host is down.
public static var EHOSTDOWN: POSIXError.Code { return .EHOSTDOWN }
#endif

/// No route to host.
public static var EHOSTUNREACH: POSIXError.Code { return .EHOSTUNREACH }
Expand All @@ -1229,16 +1237,18 @@ extension POSIXError {
#endif

#if !os(Windows)
#if !os(WASI)
/// Too many users.
public static var EUSERS: POSIXError.Code { return .EUSERS }
#endif

/// Disk quota exceeded.
public static var EDQUOT: POSIXError.Code { return .EDQUOT }
#endif

/// Network File System

#if !os(Windows)
#if !os(Windows) && !os(WASI)
/// Stale NFS file handle.
public static var ESTALE: POSIXError.Code { return .ESTALE }

Expand Down Expand Up @@ -1346,23 +1356,27 @@ extension POSIXError {
/// Reserved.
public static var EMULTIHOP: POSIXError.Code { return .EMULTIHOP }

#if !os(WASI)
/// No message available on STREAM.
public static var ENODATA: POSIXError.Code { return .ENODATA }
#endif

/// Reserved.
public static var ENOLINK: POSIXError.Code { return .ENOLINK }

#if !os(WASI)
/// No STREAM resources.
public static var ENOSR: POSIXError.Code { return .ENOSR }

/// Not a STREAM.
public static var ENOSTR: POSIXError.Code { return .ENOSTR }
#endif
#endif

/// Protocol error.
public static var EPROTO: POSIXError.Code { return .EPROTO }

#if !os(OpenBSD)
#if !os(OpenBSD) && !os(WASI)
/// STREAM ioctl timeout.
public static var ETIME: POSIXError.Code { return .ETIME }
#endif
Expand Down