|
@@ -13,6 +13,10 @@ General_Error :: enum u32 {
|
|
|
|
|
|
Timeout,
|
|
|
|
|
|
+ // Indicates that an attempt to retrieve a file's size was made, but the
|
|
|
+ // file doesn't have a size.
|
|
|
+ No_Size,
|
|
|
+
|
|
|
Invalid_File,
|
|
|
Invalid_Dir,
|
|
|
Invalid_Path,
|
|
@@ -22,9 +26,15 @@ General_Error :: enum u32 {
|
|
|
|
|
|
Platform_Error :: enum i32 {None=0}
|
|
|
|
|
|
+Read_Error :: enum u32 {
|
|
|
+ None,
|
|
|
+ Broken_Pipe,
|
|
|
+}
|
|
|
+
|
|
|
Error :: union #shared_nil {
|
|
|
General_Error,
|
|
|
io.Error,
|
|
|
+ Read_Error,
|
|
|
runtime.Allocator_Error,
|
|
|
Platform_Error,
|
|
|
}
|
|
@@ -51,6 +61,7 @@ error_string :: proc(ferr: Error) -> string {
|
|
|
case .Not_Exist: return "file does not exist"
|
|
|
case .Closed: return "file already closed"
|
|
|
case .Timeout: return "i/o timeout"
|
|
|
+ case .No_Size: return "file has no definite size"
|
|
|
case .Invalid_File: return "invalid file"
|
|
|
case .Invalid_Dir: return "invalid directory"
|
|
|
case .Invalid_Path: return "invalid path"
|
|
@@ -82,6 +93,11 @@ error_string :: proc(ferr: Error) -> string {
|
|
|
case .Invalid_Argument: return "invalid allocator argument"
|
|
|
case .Mode_Not_Implemented: return "allocator mode not implemented"
|
|
|
}
|
|
|
+ case Read_Error:
|
|
|
+ switch e {
|
|
|
+ case .None: return ""
|
|
|
+ case .Broken_Pipe: return "Broken pipe"
|
|
|
+ }
|
|
|
case Platform_Error:
|
|
|
return _error_string(i32(e))
|
|
|
}
|