1. Moritz Wilhelmy
  2. lua-bencode
Issue #5 resolved

use less error()

Moritz Wilhelmy
repo owner created an issue

Using error on every possible occasion is bad. In the current implementation, client code will almost certainly have to use pcall. false or nil should be returned instead, along with an error message.

Comments (5)

  1. Moritz Wilhelmy reporter

    Well, that doesn't fix it very well. I'm currently checking whether an error is returned on every single recursive call. If someone has a better idea, please speak up. Patches welcome. This has the slight advantage of actually working as intended. I'd use an exception here and a conditional catch, but that's not what lua's designers had in mind when designing the exception system.

  2. Log in to comment