How to make promise fail with an error in clojure?

Viewed 189

I am trying to learn about Promise in clojure. From the docs, I can see we can create promise using promise function:

(def p (promise))

and we can resolve it using deliver function like this

(deliver p 42)

I want to understand, how can we reject a promise with error or exception. I've tried docs but it doesn't seems to help. I am new to functional programming and wondering there could be a different way for failed promises.

1 Answers

You can use fail function to reject a promise.

Please refer to this link for more details.

Related