Crossposting this from here for visibility.
I have a simple before_auth hook registered on my server to verify the version of the client. If the client is not on the latest version, I want to get an error back that can prompt the user to update. However, it looks like the Error code and Error Message from the hook is not getting mapped properly to the NERROR struct. This makes handling the error a bit more complicated than I thought it would be. Is this expected behavior?
Nakama Server Common Version 3.32.0
C++ Client Version 2.8.5
My LUA Module:
My C++ Function:
Console Log showing the put print statement in the errorCallback:
Maybe you can have a look @RicardRC.
Any comment here? I’d love to know if this is expected or if I’m doing it wrong? Thanks!
Hello Mehoo462,
Unfortunately you are doing what needs to be done to gather the server sent error code. The code that you are gathering is the transport layer error code, it keeps no track of the underlying server sent error code. You can see it in the relevant code snippet that manages errors, it merely translated the http response code to an internal error code, or tries to extract said error from the response json. It’s not designed to manage custom defined error codes, anything that does not conform to the http error codes that we care about is left as code = ErrorCode::Unknown. Which you are indeed always seeing as 0.
I’ll see what can be done to pass along both error codes, not just transport.
Okay. That’s for letting me know. That’s a bit rough, and doesn’t seem aligned to how the HTTP Client handles to these things (per @sesposito’s post here)
Essentiallyit means I need to keep the error codes for my custom functions to a fixed number of digits. That way I can split the Message string on a fixed number of characters. Otherwise I will need to use REGEX to distinguish the error message from the error code… which just feels painful.
I’ll roll with it for now. Looking forward to any updates. Thanks!