Added noUnhandledHandler

This commit is contained in:
yglukhov 2015-06-15 23:30:09 +03:00
commit ffa4f8dc99

View file

@ -114,19 +114,21 @@ proc unhandledException(e: ref Exception) {.
proc raiseException(e: ref Exception, ename: cstring) {. proc raiseException(e: ref Exception, ename: cstring) {.
compilerproc, asmNoStackFrame.} = compilerproc, asmNoStackFrame.} =
e.name = ename e.name = ename
if excHandler == 0: when not defined(noUnhandledHandler):
unhandledException(e) if excHandler == 0:
unhandledException(e)
asm "throw `e`;" asm "throw `e`;"
proc reraiseException() {.compilerproc, asmNoStackFrame.} = proc reraiseException() {.compilerproc, asmNoStackFrame.} =
if lastJSError == nil: if lastJSError == nil:
raise newException(ReraiseError, "no exception to reraise") raise newException(ReraiseError, "no exception to reraise")
else: else:
if excHandler == 0: when not defined(noUnhandledHandler):
var isNimException : bool if excHandler == 0:
asm "`isNimException` = lastJSError.m_type;" var isNimException : bool
if isNimException: asm "`isNimException` = lastJSError.m_type;"
unhandledException(cast[ref Exception](lastJSError)) if isNimException:
unhandledException(cast[ref Exception](lastJSError))
asm "throw lastJSError;" asm "throw lastJSError;"
proc raiseOverflow {.exportc: "raiseOverflow", noreturn.} = proc raiseOverflow {.exportc: "raiseOverflow", noreturn.} =