Try to map to General_Error where possible

This commit is contained in:
gingerBill
2024-08-04 11:44:45 +01:00
parent 28666414bc
commit def2e2e271
8 changed files with 103 additions and 7 deletions
+12 -1
View File
@@ -521,7 +521,18 @@ _get_errno :: proc(res: int) -> Errno {
// get errno from libc
get_last_error :: proc "contextless" () -> Error {
return Platform_Error(__errno_location()^)
err := Platform_Error(__errno_location()^)
#partial switch err {
case .NONE:
return nil
case .EPERM:
return .Permission_Denied
case .EEXIST:
return .Exist
case .ENOENT:
return .Not_Exist
}
return err
}
personality :: proc(persona: u64) -> (Errno) {