How to extract error message from Js.Promise.error

What is the recommended way to extract a string-type error message from a value of type Js.Promise.error?

Thanks,
Ethan

You can stringify the error with Js.String.make(yourError)

Personally, I only use that in the case when the error comes from outside of my realm (e.g. a HTTP-client error) or when JSON decoding fails.

2 Likes

Great! Thank you for the information.