I’m logging in users through Email/Password authentication. I’m reading error codes to handle specific situations, like (1) when email confirmation is required after creating an account and (2) when user tries to create an account with an existing email address.
Previously:
(1) “confirmation needed” would return error code 47
(2) “email already in use” would return 49.
After updating to a more recent version of realm-core and realm-cocoa:
(1) “confirmation needed” now returns error code 24
(2) “email already in use” now returns error code 25.
Is there a documentation for this change?
In this realm-core file, error code 25 is called value_duplicate_name, so at least I can see some logic for the (2) error, though error code account_name_in_use = 49 still exists. But error code 24 is linked to value_already_exists, which makes no sense for the (1) “confirmation needed” error.
Is there a logic behind this change? Handling realm errors when it’s so poorly documented is already a challenge, if you start changing the codes between versions it’s not maintainable at all anymore…
Ok so now I’m sure this is a bug. The code for (3) invalid credentials —like user entering a wrong password— is now function_not_found = 26 instead of invalid_email_password = 50 . This makes no sense at all.
@Jean-Baptiste_Beau - sorry for the inconvenience with the error codes changing across some Swift SDK releases. There was a project merged into Realm Core 13.18.0 (Swift SDK 10.42.2) that consolidated/updated a lot of the error codes that will hopefully help to make the numeric values more stable.
Of note, there are error code definitions in RLMError.h that you can use instead of the numeric values to potentially help mitigate the “ever-changing” error codes
Thanks @Michael_Wilkerson-Barker for your answer. I’ve answered on this issue. I think there is some issue with some constants. I will close this topic to avoid duplicates.