Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 1.02 KB

the-failwith-function.md

File metadata and controls

30 lines (21 loc) · 1.02 KB
title description ms.date
Exceptions: The failwith Function
Learn how the 'failwith' function generates an F# exception.
05/16/2016

Exceptions: The failwith Function

The failwith function generates an F# exception.

Syntax

failwith error-message-string

Remarks

The error-message-string in the previous syntax is a literal string or a value of type string. It becomes the Message property of the exception.

The exception that is generated by failwith is a System.Exception exception, which is a reference that has the name Failure in F# code. The following code illustrates the use of failwith to throw an exception.

[!code-fsharpMain]

See also