How do I catch a rejection in Mint? #609
Answered
by
nilslindemann
nilslindemann
asked this question in
Answered
-
let choice =
await Window.confirm("is this ok?")
// choice is now a Result(String, Void)
// this does not work. The console gives `Uncaught (in promise)` when I press the cancel button
// and `text` will not be `"chancelled"`.
let text =
case choice {
Result::Ok => "ok button pressed"
=> "chancelled"
} How do I pattern match this, so that I get the text "chancelled" when the user presses cancel and how do I prevent the |
Beta Was this translation helpful? Give feedback.
Answered by
nilslindemann
May 28, 2023
Replies: 1 comment 2 replies
-
Hmm, I am starting to believe this is an error, |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
nilslindemann
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hmm, I am starting to believe this is an error,
reject
should beresolve
. It is the only reject in the code base and Built-in Types says: "In Mint promises have only one parameter result".