Added a CATCH if the account creation fails

This commit is contained in:
Alfred Kamanda 2024-08-27 13:38:08 +03:00
parent 7e95e7cbb3
commit bf99ed8482
Signed by: Alfred-mk
GPG Key ID: 7EA3D01708908703
7 changed files with 10 additions and 4 deletions

View File

@ -33,7 +33,7 @@ func main() {
fmt.Fprintf(os.Stderr, "starting session at symbol '%s' using resource dir: %s\n", root, dir) fmt.Fprintf(os.Stderr, "starting session at symbol '%s' using resource dir: %s\n", root, dir)
ctx := context.Background() ctx := context.Background()
st := state.NewState(14) st := state.NewState(15)
st.UseDebug() st.UseDebug()
state.FlagDebugger.Register(models.USERFLAG_LANGUAGE_SET, "LANGUAGE_CHANGE") state.FlagDebugger.Register(models.USERFLAG_LANGUAGE_SET, "LANGUAGE_CHANGE")
state.FlagDebugger.Register(models.USERFLAG_ACCOUNT_CREATED, "ACCOUNT_CREATED") state.FlagDebugger.Register(models.USERFLAG_ACCOUNT_CREATED, "ACCOUNT_CREATED")
@ -49,8 +49,7 @@ func main() {
state.FlagDebugger.Register(models.USERFLAG_UNLOCKFORUPDATE,"UNLOCKFORUPDATE") state.FlagDebugger.Register(models.USERFLAG_UNLOCKFORUPDATE,"UNLOCKFORUPDATE")
state.FlagDebugger.Register(models.USERFLAG_VALIDPIN,"VALIDPIN") state.FlagDebugger.Register(models.USERFLAG_VALIDPIN,"VALIDPIN")
state.FlagDebugger.Register(models.USERFLAG_VALIDPIN,"ACCOUNTUNLOCKED") state.FlagDebugger.Register(models.USERFLAG_VALIDPIN,"ACCOUNTUNLOCKED")
state.FlagDebugger.Register(models.USERFLAG_ACCOUNT_CREATION_FAILED,"ACCOUNT_CREATION_FAILED")
rfs := resource.NewFsResource(scriptDir) rfs := resource.NewFsResource(scriptDir)
ca := cache.NewCache() ca := cache.NewCache()

View File

@ -64,7 +64,7 @@ func (h *Handlers) CreateAccount(ctx context.Context, sym string, input []byte)
accountResp, err := server.CreateAccount() accountResp, err := server.CreateAccount()
if err != nil { if err != nil {
fmt.Println("Failed to create account:", err) res.FlagSet = append(res.FlagSet, models.USERFLAG_ACCOUNT_CREATION_FAILED)
return res, err return res, err
} }

View File

@ -17,4 +17,5 @@ const (
USERFLAG_VALIDPIN USERFLAG_VALIDPIN
USERFLAG_PINMISMATCH USERFLAG_PINMISMATCH
USERFLAG_INCORRECTDATEFORMAT USERFLAG_INCORRECTDATEFORMAT
USERFLAG_ACCOUNT_CREATION_FAILED
) )

View File

@ -0,0 +1 @@
Your account creation request failed. Please try again later.

View File

@ -0,0 +1,3 @@
MOUT quit 9
HALT
INCMP quit 9

View File

@ -0,0 +1 @@
Ombi lako la kusajiliwa haliwezi kukamilishwa. Tafadhali jaribu tena baadaye.

View File

@ -1,4 +1,5 @@
LOAD create_account 0 LOAD create_account 0
CATCH account_creation_failed 22 1
MOUT exit 0 MOUT exit 0
HALT HALT
LOAD save_pin 0 LOAD save_pin 0