mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 11:54:11 +00:00
EOS exception now contains the error code.
This commit is contained in:
@@ -260,11 +260,12 @@ proc osError*(errorCode: TOSErrorCode) =
|
||||
##
|
||||
## If the error code is ``0`` or an error message could not be retrieved,
|
||||
## the message ``unknown OS error`` will be used.
|
||||
let msg = osErrorMsg(errorCode)
|
||||
if msg == "":
|
||||
raise newException(EOS, "unknown OS error")
|
||||
else:
|
||||
raise newException(EOS, msg)
|
||||
var e: ref EOS; new(e)
|
||||
e.errorCode = errorCode.int32
|
||||
e.msg = osErrorMsg(errorCode)
|
||||
if e.msg == "":
|
||||
e.msg = "unknown OS error"
|
||||
raise e
|
||||
|
||||
{.push stackTrace:off.}
|
||||
proc osLastError*(): TOSErrorCode =
|
||||
|
||||
@@ -260,6 +260,7 @@ type
|
||||
## system raises.
|
||||
EIO* = object of ESystem ## raised if an IO error occured.
|
||||
EOS* = object of ESystem ## raised if an operating system service failed.
|
||||
errorCode*: int32 ## OS-defined error code describing this error.
|
||||
EInvalidLibrary* = object of EOS ## raised if a dynamic library
|
||||
## could not be loaded.
|
||||
EResourceExhausted* = object of ESystem ## raised if a resource request
|
||||
|
||||
Reference in New Issue
Block a user