As a Roblox developer, it is currently too hard to easily handle Http errors, this is in regards to the HttpError errors that emit when the call fails instead of getting a response.
There’s a HttpError enum out there which appears to wrap each of Roblox’s HTTP errors, but developers cant utilise it, since HttpService chooses to just throw a Lua error instead of this enum.
The internal method, RequestInternal chooses to return an error table, with this enum as one of the keys, instead of a Lua error. This is another reason to let developers use the HttpRequest (which also allows cancelling) object instead of the existing methods.
If Roblox is able to address this issue, it would improve my development experience because I’d be able to handle different http errors more elegantly rather than having a Lua error.
(ps, afaik, each error is formed as HttpError: %s [except Timedout for some reason], but at any point, roblox could change this, this is a more future proof feature request. lets not get another debug.traceback, shall we?)
pcall returns a string that isn’t always as easily parseable as an Enum would be, plus there is no future-proof guarentee for the formatting of the error, it could change at any time; I assume that it was this feature-request seeks to resolve.
You could argue, why not do this for every other failable method (which tbf is a good thing to go towards in the long run), specifically for this, the mechanisms are already there where it would be trivial to implement this; HttpError and a class to get it when a HTTP request fails are both there, its just locked to an internal Instance right now.
Luau error handling is a mess because although error can take anything and it’ll passed up a pcall stack (iirc its otherwise __tostring’d and outputted), C side functions always throw a pure string, as this is vanilla Lua behaviour.
Relying on string formatting is bad because it creates a coupling to an implementation detail that could break at any point. There are some HTTP errors where it’s safe to retry so many times, ie: TimedOut is the main one.
Roblox has completely rewritten Lua, which is why we now have Luau instead of the original Lua. All functions have been reimplemented in C++, and significant changes have been made to memory management. These changes impact strings, tables, and function call optimizations. Even without native code generation, the current implementation treats tables the same way as they are handled on the C++ side.
My argument is that since you included metamethods (a core part of object-oriented programming in classic Lua), fully utilizing these features requires avoiding abstraction behind unnecessary table or function calls. Also in case of here, simply finding a first number and then reading 2 letters after it would provide you with all the needed info on the call status.