diff --git a/internal/algod/participation/participation.go b/internal/algod/participation/participation.go index bf55cc4b..bcfb80b5 100644 --- a/internal/algod/participation/participation.go +++ b/internal/algod/participation/participation.go @@ -65,6 +65,10 @@ func GenerateKeys( return nil, err } if key.StatusCode() != 200 { + if key.JSON400 != nil { + return nil, errors.New(key.JSON400.Message) + } + status := key.Status() if status != "" { return nil, errors.New(status) diff --git a/ui/app/keys.go b/ui/app/keys.go index 418794e8..dc6eea46 100644 --- a/ui/app/keys.go +++ b/ui/app/keys.go @@ -59,7 +59,7 @@ func GenerateCmd(account string, rangeType participation.RangeType, duration int Key: nil, Address: "", Active: false, - Err: &err, + Err: err, Type: ExceptionModal, } } diff --git a/ui/app/modal.go b/ui/app/modal.go index 92e148fe..1055ae81 100644 --- a/ui/app/modal.go +++ b/ui/app/modal.go @@ -51,8 +51,8 @@ type ModalEvent struct { // Address represents the address associated with the modal event. It is used to identify the relevant account or key. Address string - // Err is a pointer to an error that represents an exceptional condition or failure state for the modal event. - Err *error + // Err is an error that represents an exceptional condition or failure state for the modal event. + Err error // Type represents the specific category or variant of the modal event. Type ModalType diff --git a/ui/modal/controller.go b/ui/modal/controller.go index b90c9393..9f5b1f3a 100644 --- a/ui/modal/controller.go +++ b/ui/modal/controller.go @@ -92,6 +92,13 @@ func (m ViewModel) HandleMessage(msg tea.Msg) (*ViewModel, tea.Cmd) { } case app.ModalEvent: + if msg.Type == app.ExceptionModal { + m.Open = true + m.exceptionModal.Message = msg.Err.Error() + m.generateModal.SetStep(generate.AddressStep) + m.SetType(app.ExceptionModal) + } + if msg.Type == app.InfoModal { m.generateModal.SetStep(generate.AddressStep) }