1. Anders Ruud
  2. love
  3. Issues

Issues

Issue #503 duplicate

Renaming love.errhand/love.releaseerrhand

hahawoo
created an issue

I propose that love.errhand and love.releaseerrhand be renamed to something easier to read, perhaps something like love.error and love.releaseerror (Edit: Or love.errorhandler and love.releaseerrorhandler), and also that they be added to the wiki.

Edit: To be clear on why I propose these changes:

  • I don't think the current names make it obvious as to what these callbacks do.
  • They seem inconsistent with the other callbacks due to using abbreviated words.

love.errorhandler and love.releaseerrorhandler aren't abbreviated, and I think it's also easier to decipher what they do.

I also thought that perhaps "handler" was redundant. I'm probably confused as to what the word "handler" means, but I would have thought love.focus handles changes in focus, love.quit handles when the game is quit, etc., and it would follow that love.error handles when the game errors.

Comments (13)

  1. hahawoo reporter

    Good point, but if listed under callbacks I hope its purpose would be clear. I don't think love.error implies that it's for creating errors any more than love.quit implies that it quits the program.

    Edit: It doesn't actually have to be listed under callbacks if it's deemed too esoteric, but if the wiki page said it was a callback I hope it wouldn't be confusing, and also it has that love.function structure so it kind of looks like a callback.

  2. kikito

    If I'm understanding this correctly, the difference between love.errhand & love.releaseerrhand is that the former is invoked when there is an error but no release info (love._release is falsy) while the later is invoked when there is release info. Appart from that, they look very similar.

    So similar, in fact, that I would recommend merging them into one single function (with an if inside to handle the existence of love._release where appropriate).

    Since this (now single) function is supposed to be used as a callback, and all other callbacks are all lowercase and end in "ed", I propose love.errorhappened().

  3. hahawoo reporter

    The two functions could share a lot of code, like they do by default, so combining them does seem like a good idea. Perhaps it could be passed a boolean argument which is true if it's in release mode, kind of like how love.focus has an argument which is true if the window gains focus.

  4. Log in to comment