EOS exception now contains the error code.

This commit is contained in:
Dominik Picheta 2014-03-11 23:06:22 +00:00
commit 15919b7c98
2 changed files with 7 additions and 5 deletions

View file

@ -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 =