Skip to content

Commit 6dbee81

Browse files
fix(passport): add user-friendly message for 409 error in registerOffchain
Following the ts-immutable-sdk Passport v3 refactoring (commit 240cd2f15, Dec 8 2025), which introduced stricter validation via toUserImx() during user registration, we now explicitly handle the 409 Conflict error in ImxRegisterScript. When a user is already registered off-chain, the API returns a 409 error with USER_REGISTRATION_ERROR type. This change detects this specific scenario and displays a user-friendly message: 'Passport account already registered'. This ensures the UI tests (test_4_imx_functions) continue to pass and provides a better user experience when attempting to register an already registered account.
1 parent 251e4f4 commit 6dbee81

File tree

1 file changed

+11
-2
lines changed
  • src/Packages/Passport/Samples~/SamplesScenesScripts/Scripts/Passport/ImxRegister

1 file changed

+11
-2
lines changed

src/Packages/Passport/Samples~/SamplesScenesScripts/Scripts/Passport/ImxRegister/ImxRegisterScript.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,16 @@ public async void RegisterOffchain()
4343
}
4444
catch (PassportException e)
4545
{
46-
ShowOutput($"Unable to register off-chain: {e.Message} ({e.Type})");
46+
// Handle 409 - account already registered
47+
if (e.Type == PassportErrorType.USER_REGISTRATION_ERROR &&
48+
(e.Message.Contains("409") || e.Message.Contains("already registered")))
49+
{
50+
ShowOutput("Passport account already registered");
51+
}
52+
else
53+
{
54+
ShowOutput($"Unable to register off-chain: {e.Message} ({e.Type})");
55+
}
4756
}
4857
catch (Exception e)
4958
{
@@ -58,4 +67,4 @@ private void ShowOutput(string message)
5867
Output.text = message;
5968
}
6069
}
61-
}
70+
}

0 commit comments

Comments
 (0)