[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug: Error handling in source blocks.
From: |
Berry, Charles |
Subject: |
Re: bug: Error handling in source blocks. |
Date: |
Tue, 10 Aug 2021 19:42:07 +0000 |
> On Aug 9, 2021, at 9:13 PM, James Powell <powellj@pdx.edu> wrote:
>
> Error handling is important and hard to get right. Me, I prefer to
> treat every warning as an error (-Werror in gcc, "options(warn=2)" in
> R, etc). I want the system to grind to a halt at the least sign of
> trouble.
If the effect of an error is to return no result (as in your example), you can
use a :post header-arg to check for a nil value in `*this*' and issue a
user-error.
Example:
#+name: check-res
#+begin_src emacs-lisp
(or *this* (error "nil result"))
#+end_src
#+begin_src R :exports both :post check-res()
x <- fffff838293483$x8483848
#+end_src
See (info "(org) Results of Evaluation") and scroll to `post-processing' for
details on the :post header.
The user-error halts export.
HTH,
Chuck