emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* bug: Error handling in source blocks.
@ 2021-08-10  4:13 James Powell
  2021-08-10 19:42 ` Berry, Charles via General discussions about Org-mode.
  2021-08-10 20:30 ` Tim Cross
  0 siblings, 2 replies; 5+ messages in thread
From: James Powell @ 2021-08-10  4:13 UTC (permalink / raw)
  To: emacs-orgmode

   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.

   When I write some nonsense into a code block as in this example:

   ,----
   | : This next code block is intended to trigger an error, because that
   | : variable "fffff838293483" with that attribute/member "x8483848"
   | : probably does not exist.
   | :
   | : #+begin_src R :exports both
   | : x <- fffff838293483$x8483848
   | : #+end_src
   | :
   | : #+RESULTS:
   | :
   | : #+begin_src R :exports both :results table :colnames yes
   | : require(tidyverse)
   | : tribble(~a, ~b, 1, 2)
   | : #+end_src
   | :
   | : #+RESULTS:
   | : | a | b |
   | : |---+---|
   | : | 1 | 2 |
   | : #+end_src
   `----


   which does trigger an error in R
   ,----
   | Error: object 'fffff838293483' not found
   | [traceback follows]
   `----


   and I do org-to-PDF export, I would like the PDF to be not built and
   loud alarm bells to ring bringing the error to my attention.

   What happens instead: the document builds from org into PDF with no
   indication that anything went wrong at all, except perhaps minor bits
   of missing or incorrect text in the PDF file.  The error can easily be
   buried in the output as more and later source blocks from the same
   document are evaluated.

   Likewise, in 'sh',
   ,----
   | #+begin_src sh :exports results
   | exit 1
   | #+end_src
   `----


   Sh exits 1 to indicate an error, so I would like this to ring alarm
   bells and fail to produce a PDF on org-to-PDF export.

   We might add examples in Java, Python, C++, C along the same lines.
   All of these should be in a unit test (because error handling is 
important).
   There do not seem to be any unit tests that exercise error handling in
   org-9.4.4.

   Exceptions that are thrown in the block should also at least
   optionally always and reliably abort the org-to-PDX export and ring
   alarm bells.

   I would like to see a section in the org manual called "Error handling
   in source blocks" that discusses the issue.

   I searched for "error handling" at <https://lists.gnu.org/archive>,
   with no results that are relevant.

   thank you for your time,
   - JP

-- 
James E. Powell, MS
Pronouns: he/him/his
Applied Physics PhD Candidate
Department of Physics
Portland State University
Home page: http://web.pdx.edu/~powellj
Office: SRTC 409B Phone: +1-503-725-8515



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-11  6:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10  4:13 bug: Error handling in source blocks James Powell
2021-08-10 19:42 ` Berry, Charles via General discussions about Org-mode.
2021-08-10 20:30 ` Tim Cross
2021-08-10 23:14   ` Tom Gillespie
2021-08-11  6:23   ` tomas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).