8 ms·
Another good reason for compiling to JavaScript from a higher level platform. With GWT you get complete and accurate stacktraces straight into the Java codebas
by johnyzee 13y ago
Another good reason for compiling to JavaScript from a higher level platform.
With GWT you get complete and accurate stacktraces straight into the Java codebase. Catch it, send it to the backend for logging. Most client-side JavaScript errors are noticed and fixed as soon as the first user has encountered them.
This even works with heavily obfuscated/minified JavaScript, thanks to the symbol maps output by the GWT compilation, which can be used to deobfuscate any stack trace.
Here is an example from our HTML5 game[1], 100,000+ lines of code built entirely in GWT:
Client sees this:
com.google.gwt.core.client.JavaScriptException:
stack: TypeError
at pHc (AAC650305790C67B7708D7A391EFF482.cache.html:4929:343)
at Object.wIc [as Nc] (AAC650305790C67B7708D7A391EFF482.cache.html:5065:16814)
at Object.Af [as Mc] (AAC650305790C67B7708D7A391EFF482.cache.html:5038:5333)
atAAC650305790C67B7708D7A391EFF482.cache.html:3558:58
at Hh (AAC650305790C67B7708D7A391EFF482.cache.html:2921:29)
at Kh (AAC650305790C67B7708D7A391EFF482.cache.html:4588:59)
at AAC650305790C67B7708D7A391EFF482.cache.html:3913:45
type: type_error
arguments: f,
at Unknown.pHc(Unknown Source)
at Unknown.wIc(Unknown Source)
at Unknown.Af(Unknown Source)
at Unknown.anonymous(Unknown Source)
at Unknown.Hh(Unknown Source)
at Unknown.Kh(Unknown Source)
at Unknown.anonymous(Unknown Source)
This is sent to the server, deobfuscated and logged like this:
2013-01-10 21:07:04 ERROR ExceptionLogCommandCommand...ommand.execute(ExceptionLogCommandCommand.java:44): Deobfuscated client-side exception:
java.lang.IllegalStateException: Player not in line-of-sight for shot (viewport=[[887, 638, width/height=800/560]], player x/y=[1413, 876])
at java.lang.IllegalStateException.IllegalStateException(IllegalStateException.java)
at webworks.engine.client.player.Enemy.shootGetShotPosition(Enemy.java)
at webworks.engine.client.player.AbstractPlayer$10.perform(AbstractPlayer.java)
at webworks.engine.client.player.AbstractPlayer.$animate(AbstractPlayer.java)
at webworks.engine.client.WebworksEngine$5.perform(WebworksEngine.java)
at webworks.engine.client.WebworksEngine.$render(WebworksEngine.java)
at webworks.engine.client.WebworksEngine$25.doRun(WebworksEngine.java)
mozilla/5.0 (windows nt 6.0) applewebkit/537.11 (khtml, like gecko) chrome/23.0.1271.97 safari/537.11
With this log entry, most of the time the error can be found simply by looking at the code for a few seconds.
[1] http://www.webworks.dk/enginetest http://www.webworks.dk/enginetest