Skip to content

Commit

Permalink
modify name of function and replace return by panic
Browse files Browse the repository at this point in the history
  • Loading branch information
kazai777 committed May 9, 2024
1 parent bf3b0dd commit 3796c3c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions examples/gno.land/r/demo/profile/profile.gno
Original file line number Diff line number Diff line change
Expand Up @@ -122,24 +122,26 @@ func DisplayProfileByUsername(username string) UserProfile {
if addr, exists := usernameIndex.Get(username); exists {
return DisplayProfileByAddress(std.Address(addr.(string)))
}

panic("username not found")
}

// Display username
func DisplayUsername(address std.Address) string {
func DisplayUsernameByAddress(address std.Address) string {
if value, exists := profiles.Get(address.String()); exists {
return value.(UserProfile).Username
}
return "Address not found"

panic("address not found")
}

// Display address from username
func DisplayAddress(username string) string {
func DisplayAddressByUsername(username string) string {
if addr, exists := usernameIndex.Get(username); exists {
return addr.(string)
}
return "Username not found"

panic("username not found")
}

// Display avatarurl from address or username
Expand Down

0 comments on commit 3796c3c

Please sign in to comment.