33** Table of Contents** * generated with [ DocToc] ( https://github.com/thlorenz/doctoc ) *
44
55 - [ The first script] ( #the-first-script )
6- - [ Boostrapping Xake.Core] ( #boostrapping -xakecore )
6+ - [ Bootstrapping Xake.Core] ( #bootstrapping -xakecore )
77 - [ So what?] ( #so-what )
88 - [ Dependencies tracking] ( #dependencies-tracking )
99 - [ Running multiple rules in parallel] ( #running-multiple-rules-in-parallel )
1818 - [ wantOverride] ( #wantoverride )
1919 - [ action computation] ( #action-computation )
2020 - [ Tasks, ` do! ` notation] ( #tasks-do-notation )
21+ - [ Exception handling] ( #exception-handling )
2122 - [ need] ( #need )
2223 - [ Filesets] ( #filesets )
2324 - [ Other functions] ( #other-functions )
@@ -62,7 +63,7 @@ Here are we doing the following steps:
62631 . specify the default target ("main") requires "hw.exe" target
63641 . define the rule for "hw.exe" target
6465
65- ### Boostrapping Xake.Core
66+ ### Bootstrapping Xake.Core
6667
6768The steps above assumes you've downloaded xake core assembly to .tools folder.
6869The next script demonstrates how to create the build script that does not require any installation steps:
@@ -290,11 +291,11 @@ If the task (action) returns a value which you do not need use Action.Ignore:
290291``` fsharp
291292 action {
292293 do! system "ls" [] |> Action.Ignore
293- if error_code <> 0 then failwith...
294294 }
295295```
296296
297297### Exception handling
298+
298299` action ` block allows to handle exceptions with idiomatic try/with and try/finally blocks.
299300``` fsharp
300301 phony "main" (action {
@@ -304,14 +305,13 @@ If the task (action) returns a value which you do not need use Action.Ignore:
304305 do! trace Level.Info "try"
305306 failwith "Ouch"
306307 with e ->
307- printfn "Error '%s' occured" e.Message
308+ do! trace Level.Error "Error '%s' occured" e.Message
308309 finally
309310 printfn "Finally executed"
310-
311311 printfn "execution continues after try blocks"
312312 })
313313```
314- Notice ` trace ` function just like any other actions cannot be used inside ` with ` and ` finally ` blocks due to language limitations.
314+ Notice ` trace ` function just like any other actions (do! notation) cannot be used in ` finally ` blocks due to language limitations.
315315
316316` WhenError ` function is another option to handle errors.
317317``` fsharp
0 commit comments