This project is read-only.
Raising a 'Failure' exception

Category:
Exceptions
Description: How to raise a simple exception
Code:
let ExceptionSample1() : unit =
failwith "Here's how to raise a simple 'Failure' exception"


Execution Result:
Exception raised: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: Here's how to raise a simple 'Failure' exception
at Microsoft.FSharp.Core.Operators.FailWith[T](String message)
at Samples.Beginners.ExceptionSample1() in C:\MyCode\Samples\SampleProject\SampleProject\Samples.Beginners.fs:line 148
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Support.Helper.Utils.samples@190-3.Invoke(Unit unitVar0) in C:\MyCode\Samples\SampleProject\SampleProject\Supportive.Helper.fs:line 190
at Support.Helper.Utils.getExecutionResult(FSharpOption`1 sampleOption) in C:\MyCode\Samples\SampleProject\SampleProject\Supportive.Helper.fs:line 256

Last edited Sep 14, 2011 at 3:42 AM by ttliu2000, version 1

Comments

No comments yet.