Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make error backtraces more salient #57

Open
enebo opened this issue Jan 20, 2016 · 1 comment
Open

Make error backtraces more salient #57

enebo opened this issue Jan 20, 2016 · 1 comment

Comments

@enebo
Copy link
Owner

enebo commented Jan 20, 2016

In issue #56 we see a typical backtrace in Purugin as it stands today. Here is one I just generated:

rg.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
    at net.minecraft.server.v1_8_R3.PlayerList.onPlayerJoin(PlayerList.java:298) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
    at net.minecraft.server.v1_8_R3.PlayerList.a(PlayerList.java:157) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
    at net.minecraft.server.v1_8_R3.LoginListener.b(LoginListener.java:144) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
    at net.minecraft.server.v1_8_R3.LoginListener.c(LoginListener.java:54) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
    at net.minecraft.server.v1_8_R3.NetworkManager.a(NetworkManager.java:231) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
    at net.minecraft.server.v1_8_R3.ServerConnection.c(ServerConnection.java:148) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
    at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:814) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
    at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
    at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot-1.8.8.jar:git-Spigot-db6de12-07c3001]
    at java.lang.Thread.run(Thread.java:745) [?:1.7.0_79]
Caused by: org.jruby.exceptions.RaiseException: (NoMethodError) undefined method `display_name' for #<Java::OrgBukkitEventPlayer::PlayerJoinEvent:0x5a3eca5e>
    at RUBY.on_enable(/Users/enebo/work/games/minecraft/plugins/a.rb:7) ~[?:?]
    at org.jruby.RubyProc.call(org/jruby/RubyProc.java:271) ~[?:?]
    at RUBY.on_event((eval):4) ~[?:?]
[

You will see Java framework is generating a wrapped exception but the real exception we want is our RaiseException generated from the ruby runtime itself.

So the challenge is to overload the handler OR possibly subclass the PluginException itself to not show all the other crud of spigot/craftbukkit in getMessages (or whatever Java exception backtrace generating method is called).

@enebo
Copy link
Owner Author

enebo commented Jan 20, 2016

Ack I see the path forward and it is a little ugly. We need to override JavaPluginLoader.createRegisteredListeners in RubyPluginLoader. In this method if we can see it is a Ruby-derived class (not sure best way on this) we will set it up to use our own EventExecutor which generates a custom EventException which only returns the ruby bits of the backtrace. So not all that horrible...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant