Events
17 Mar, 21 - 21 Mar, 10
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This section contains information about exception handling support in F#.
Exception handling is the standard way of handling error conditions in the .NET Framework. Thus, any .NET language must support this mechanism, including F#. An exception is an object that encapsulates information about an error. When errors occur, exceptions are raised and regular execution stops. Instead, the runtime searches for an appropriate handler for the exception. The search starts in the current function, and proceeds up the stack through the layers of callers until a matching handler is found. Then the handler is executed.
In addition, as the stack is unwound, the runtime executes any code in finally
blocks, to guarantee that objects are cleaned up correctly during the unwinding process.
Title | Description |
---|---|
Exception Types | Describes how to declare an exception type. |
Exceptions: The try...with Expression |
Describes the language construct that supports exception handling. |
Exceptions: The try...finally Expression |
Describes the language construct that enables you to execute clean-up code as the stack unwinds when an exception is thrown. |
Exceptions: the raise Function |
Describes how to throw an exception object. |
Exceptions: The failwith Function |
Describes how to generate a general F# exception. |
Exceptions: The invalidArg Function |
Describes how to generate an invalid argument exception. |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Events
17 Mar, 21 - 21 Mar, 10
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register now