While it's not recommend to make extensive use of exceptions in ReasonML, it's still worth introducing them. In this lesson we walk through how to create, raise and catch them.
Instructor: 00:00 Reason also has exceptions. For example, if you try to find the integer 42 inside an empty list, an exception, not found, is thrown.
00:09 We also can raise our own exceptions using the raise function. To catch them, we can use pattern matching, since exceptions are just a special kind of variant.
Instructor: 00:25 In fact, we can directly match exceptions, as well, in a switch expression using the exception keyword.
Instructor: 00:45 Using the exception keyword, we can also create an exception.
Instructor: 00:55 In general, it's recommended to use exceptions sparingly. In most cases, you get away just fine using an option. Also, more and more often, newer APIs are doing so.