Skip to content

Commit

Permalink
Display better error message when the user already has the badge
Browse files Browse the repository at this point in the history
  • Loading branch information
vgeorge committed Apr 29, 2022
1 parent 85ad8eb commit 04551c9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pages/badges-assignment/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,12 @@ export default class NewBadgeAssignment extends Component {
)
} catch (error) {
console.log(error)
toast.error(`Unexpected error, please try again later.`)

if (error.message === 'User is already assigned to badge.') {
toast.error(`User is already assigned to this badge, please select a different one.`)
} else {
toast.error(`Unexpected error, please try again later.`)
}
}
}}
render={({ isSubmitting, values, errors, touched }) => {
Expand Down

0 comments on commit 04551c9

Please sign in to comment.