Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS JavascriptCore exception detailed stacktrace info

It seems the exception stacktrace in iOS only contains the method name or there is a bug. Below is my code of handling exceptions in JSContext.

context.exceptionHandler = { (ctx: JSContext!, value: JSValue!) in
    // type of String
    let stacktrace = value.objectForKeyedSubscript("stack").toString()
    // type of Number
    let lineNumber = value.objectForKeyedSubscript("line")
    // type of Number
    let column = value.objectForKeyedSubscript("column")
    let moreInfo = "in method \(stacktrace)Line number in file: \(lineNumber), column: \(column)"
    Logger.error("JS ERROR: \(value) \(moreInfo)")
}

And I got logs like below

ERROR : JSContextRenderer.swift:308 : setupContext : JS ERROR: Error in method clearBackground
Line number in file: 162, column: 12"

Note there is a new line right after the "clearBackground" name, I think there probably more information there.

Can anybody having similar experience confirm? Any help is appreciated. Thanks.

like image 817
Zhao Avatar asked Dec 14 '15 17:12

Zhao


1 Answers

Looks like it does show more information in the stack. Here is one of the log information I got:

JS ERROR: TypeError: undefined is not a function (evaluating 'msg.__assert__()') in method assert
syncShots
updateSync
initSync
setState
onLogicStateChanged
onLogicStateChanged
[native code]
updateMove
sendMove
shoot
onTouchUp
[native code]
_handleEvent
_dispatchEvent
. Line number in file: 183, column: 20
like image 158
Zhao Avatar answered Nov 17 '22 07:11

Zhao