Suggestion for a rule for developing bukkit plugins

Discussion in 'Plugin Development' started by robrobk, Feb 16, 2014.

?

should developers be forced to catch all exceptions?

  1. YES

    18.2%
  2. no

    81.8%
Thread Status:
Not open for further replies.
  1. Offline

    robrobk

    hi
    i run a private offline server with lots of plugins
    many of the plugins that are installed check with a website for updates.
    most of the plugin authors just assume that the server has internet so they dont bother catching
    Code:
    java.net.ConnectException
    or
    Code:
    java.net.SocketTimeoutException
    exceptions. this means that my server console is spammed with these exceptions from plugins checking for updates.

    i believe that it should be compulsory for plugin developers to catch ALL possible exceptions in their plugins to keep the console clean

    EDIT: i was just using update checking as an example to support catching all exceptions
     
  2. Offline

    knrd2

    Plugins that i use, all of these have in config file:
    update=true - what can i change to false ofc.
     
  3. Offline

    Briggybros

    I wouldn't suggest catching all exceptions else you wouldn't know where things are going wrong. However, If a plugin is published to bukkit dev, one requirement is that if there is a way for checking for updates or auto updating there must be a way to turn it off.
     
  4. Offline

    xTigerRebornx

    robrobk As people have said before me, if you are using a plugin that you've gotten from Bukkit, and it has an auto-updater, then there should be a way to disable it from the plugin (i.e. config)
     
  5. Offline

    robrobk

    all plugins that i make catch exceptions then prints a "clean" error message to the console instead of printing the messy stack trace
     
  6. Offline

    Briggybros


    To solve your problem though all you need to do is turn off the auto updates. If errors are still persisting then there is something wrong with the plugin. I would personally always leave my plugins printing their stacktrace when they error as it makes it easier to debug.
     
  7. Offline

    robrobk

    this isnt just about updating, i was just using that as an example
     
  8. Offline

    Briggybros

    Okay then, take this example;

    You've created a plugin which does whatever you like it to do, and say it uses a MySQL database.
    You set it up, catching every possible error and printing out a user friendly message when something goes wrong.
    You publish the plugin.
    Someone comes to you with a problem in the plugin.
    All they can say is; "I was running the plugin, then the console said '[WARNING] PluginName: Something went wrong with the MySQL'".

    Without the stacktrace, you do not know what exactly has gone wrong, only the rough location of where it is. If you wanted to be more precise your code would become messy for each individual line you needed to catch a possible exception for. In my opinion it is unnecessary and counter productive to make a clean report. Also, if the user is running a large server with say 50 plugins on startup, the amount of console spam is colossal anyway. I have experience trying to find what's going wrong with a server with roughly that amount of plugins running, finding a single line which isn't very descriptive isn't easy when scrolling through so many initialization messages. A stacktrace is very distinctive.
     
  9. Offline

    robrobk

    very good point
     
  10. Offline

    RawCode

    • This kind of flaming is not allowed
    absolutely stupid and harmfull suggestion.
    learn to pick plugins and setup them carefully.
     
  11. Offline

    Luke_Lax

    I would have to disagree with this because Bukkit (rightfully IMO) does not endorse offline servers so there is no need to cater for one. Cracked servers do not help or support Mojang, rather they encourage cracked copies.
     
  12. Offline

    Briggybros


    I don't think that's what he was getting at, if a server is run in offline mode, then surely plugins can still do update checks.
     
  13. Offline

    Luke_Lax

    He's saying he gets errors because plugins don't check for offline mode (or other errors crack related) which in turn suggests that bukkit approved plugins should cater for offline mode. This brings me back to my first point :)
     
  14. Offline

    RawCode

    if server works without internet is obviously offline.
    there is no support for offline servers and plugins for offline mods are not allowed.
     
    random_username likes this.
  15. Offline

    random_username

    Tbh, I don't like the idea, as:
    1. A stacktrace can help us developers locate and solve problems. Without one, you wouldn't know where to look for the error, as Briggybros said above, or what type of Exception occurred.
    2. Bukkit doesn't support Offline servers.
    3. As Luke_Lax said above, offline copies won't support Mojang.
    Anyway, this is just my opinion :)
     
  16. Offline

    robrobk

    in this situation, offline means no internet connection, group of people connected to a network that isnt plugged into the internet

    to post on bukkit, i actually had to stop the server, disconnect from the network, then connect to my other network(with internet)

    this is all because i used to let people that played on my server use my main network, but they were using all my internet at the same time
     
  17. Offline

    maxben34

    "Bukkit doesn't support offline servers."
     
    Nateb1121 likes this.
  18. Offline

    Nateb1121


    Regardless, its in offline mode and Bukkit doesn't support that.

    I see where you're coming from suggesting that, but I feel like if it was a rule a lot of newer coders would use them just to use them and not understand then and how you should implement them.
     
  19. Offline

    RawCode

    this "rule" is wrong.
    if error thrown, stacktrace must show.

    actually swallowing each exception with something like
    catch(Throwable t){}
    not allowed by oracle specs for general code.
     
  20. Offline

    xTrollxDudex

    robrobk
    Exception thrown. Whatever, its in the console, you don't need to worry about it, go play minecraft.
     
  21. Offline

    Iroh

    Locked.
    If you are not connected to the internet, you are running offline mode, which we do not support.
     
Thread Status:
Not open for further replies.

Share This Page