Skip to content

Commit 45da2de

Browse files
committed
fix prop
1 parent 6479e4d commit 45da2de

File tree

1 file changed

+14
-8
lines changed
  • examples/gno.land/r/gnoland/users/v1

1 file changed

+14
-8
lines changed

examples/gno.land/r/gnoland/users/v1/admin.gno

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,19 @@ func NewSetPausedExecutor(newPausedValue bool) dao.Executor {
2525
// The associated address and all previous names of a user that changes a name
2626
// are preserved, and all resolve to the new name.
2727
func ProposeNewName(addr std.Address, newName string) dao.Executor {
28-
cb := func() error {
29-
if matched := reUsername.MatchString(newName); !matched {
30-
return ErrInvalidUsername
31-
}
28+
if matched := reUsername.MatchString(newName); !matched {
29+
panic(ErrInvalidUsername)
30+
}
31+
32+
userData := susers.ResolveAddress(addr)
33+
if userData == nil {
34+
panic(ErrInvalidUsername)
35+
}
3236

33-
userData := susers.ResolveAddress(addr)
37+
cb := func() error {
3438
if err := userData.UpdateName(newName); err != nil {
3539
return err
3640
}
37-
3841
return nil
3942
}
4043

@@ -45,12 +48,15 @@ func ProposeNewName(addr std.Address, newName string) dao.Executor {
4548
// This will make the associated address and names unresolvable.
4649
// WARN: After deletion, the same address WILL NOT be able to register a new name.
4750
func ProposeDeleteUser(addr std.Address) dao.Executor {
51+
userData := susers.ResolveAddress(addr)
52+
if userData == nil {
53+
panic(ErrInvalidUsername)
54+
}
55+
4856
cb := func() error {
49-
userData := susers.ResolveAddress(addr)
5057
if err := userData.Delete(); err != nil {
5158
return err
5259
}
53-
5460
return nil
5561
}
5662

0 commit comments

Comments
 (0)