Skip to content

Commit e1a805a

Browse files
committed
Motor OS: make decode_error_kind more comprehensive
1 parent c871d09 commit e1a805a

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

library/Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ dependencies = [
175175

176176
[[package]]
177177
name = "moto-rt"
178-
version = "0.15.0"
178+
version = "0.15.2"
179179
source = "registry+https://github.com/rust-lang/crates.io-index"
180-
checksum = "058a2807a30527bee4c30df7ababe971cdde94372d4dbd1ff145bb403381436c"
180+
checksum = "0bf4bc387d3b3502cb92c09ec980cca909b94978e144c61da8319ecf4bc8d031"
181181
dependencies = [
182182
"rustc-std-workspace-alloc",
183183
"rustc-std-workspace-core",

library/std/src/sys/pal/motor/mod.rs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,27 @@ pub fn decode_error_kind(code: RawOsError) -> crate::io::ErrorKind {
5858
}
5959

6060
match code as moto_rt::ErrorCode /* u16 */ {
61-
E_ALREADY_IN_USE => ErrorKind::AlreadyExists,
62-
E_INVALID_FILENAME => ErrorKind::InvalidFilename,
61+
E_UNSPECIFIED => ErrorKind::Uncategorized,
62+
E_UNKNOWN => ErrorKind::Uncategorized,
63+
E_NOT_READY => ErrorKind::WouldBlock,
64+
E_NOT_IMPLEMENTED => ErrorKind::Unsupported,
65+
E_VERSION_TOO_HIGH => ErrorKind::Unsupported,
66+
E_VERSION_TOO_LOW => ErrorKind::Unsupported,
67+
E_INVALID_ARGUMENT => ErrorKind::InvalidInput,
68+
E_OUT_OF_MEMORY => ErrorKind::OutOfMemory,
69+
E_NOT_ALLOWED => ErrorKind::PermissionDenied,
6370
E_NOT_FOUND => ErrorKind::NotFound,
71+
E_INTERNAL_ERROR => ErrorKind::Other,
6472
E_TIMED_OUT => ErrorKind::TimedOut,
65-
E_NOT_IMPLEMENTED => ErrorKind::Unsupported,
66-
E_FILE_TOO_LARGE => ErrorKind::FileTooLarge,
73+
E_ALREADY_IN_USE => ErrorKind::AlreadyExists,
6774
E_UNEXPECTED_EOF => ErrorKind::UnexpectedEof,
68-
E_INVALID_ARGUMENT => ErrorKind::InvalidInput,
69-
E_NOT_READY => ErrorKind::WouldBlock,
75+
E_INVALID_FILENAME => ErrorKind::InvalidFilename,
76+
E_NOT_A_DIRECTORY => ErrorKind::NotADirectory,
77+
E_BAD_HANDLE => ErrorKind::InvalidInput,
78+
E_FILE_TOO_LARGE => ErrorKind::FileTooLarge,
7079
E_NOT_CONNECTED => ErrorKind::NotConnected,
80+
E_STORAGE_FULL => ErrorKind::StorageFull,
81+
E_INVALID_DATA => ErrorKind::InvalidData,
7182
_ => crate::io::ErrorKind::Uncategorized,
7283
}
7384
}

0 commit comments

Comments
 (0)