diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b8346c8..50802541 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased +### Added + - A new keyword argument configuration `continue_on_error::Bool = false` has been added + which controls the behavior of code execution errors. By default (`continue_on_error = + false`) execution errors are re-thrown by Literate (as before). If `continue_on_error = + true` is set the error is used as the block result and execution continues with following + blocks. ([#201], [#257]) + ## [v2.19.1] - 2024-09-13 ### Fixed - Set `:SOURCE_PATH` in the task local storage to the output file when executing code so diff --git a/src/Literate.jl b/src/Literate.jl index 866962ff..e8612380 100644 --- a/src/Literate.jl +++ b/src/Literate.jl @@ -434,9 +434,10 @@ Available options: output script. Only applicable for `Literate.script`. - `execute` (default: `true` for notebook, `false` for markdown): Whether to execute and capture the output. Only applicable for `Literate.notebook` and `Literate.markdown`. -- `continue_on_error` (default: `false`): Whether to capture and display error messages. If - `true`, blocks that error will display the error message. If `false`, errors will be - (re)thrown as is. Ignored when `execute == false`. +- `continue_on_error` (default: `false`): Whether to continue code execution of remaining + blocks after encountering an error. By default execution errors are re-thrown. If + `continue_on_error = true` the error will be used as the output of the block instead and + execution will continue. This option is only applicable when `execute = true`. - `codefence` (default: `````"````@example \$(name)" => "````"````` for `DocumenterFlavor()` and `````"````julia" => "````"````` otherwise): Pair containing opening and closing code fence for wrapping code blocks.