emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Babel] Handling of errors when using Ledger
@ 2010-10-07 11:55 Sébastien Vauban
  2010-10-07 13:36 ` Dan Davison
  0 siblings, 1 reply; 22+ messages in thread
From: Sébastien Vauban @ 2010-10-07 11:55 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

#+TITLE:     Handling of errors when using Ledger
#+LANGUAGE:  en_US

* Journal data

#+srcname: data
#+begin_src ledger :tangle journal.dat
2008/01/03 * (SCORPIOS ) SEB VAUBAN
	Assets:Bank:Checking:799997400530	                        550.00 EUR
	Assets:Bank:Transferred

2008/01/01 * ( ) UNKNOWN-PAYEE
	Assets:Bank:Checking:799997400530	                         21.91 EUR
	Expenses:Unknown
#+end_src

* Testing

** Default case

Here the results of the standards =registry= command:

#+srcname: registry-cmd
#+begin_src ledger :cmdline reg :noweb yes :session
<<data>>
#+end_src

#+results: registry-cmd
: 08-Jan-03 SEB VAUBAN            As:Ba:Che:799997400530   550.00 EUR   550.00 EUR
:                                 Asset:Bank:Transferred  -550.00 EUR            0
: 08-Jan-01 UNKNOWN-PAYEE         As:Ba:Che:799997400530    21.91 EUR    21.91 EUR
:                                 Expenses:Unknown         -21.91 EUR            0

This is a perfectly acceptable output. Ideally, it could be converted to a
real Org table, but that's not the purpose of this posting.

** Other default case

Here, I would like to take a look at the transactions which involve the
unknown account:

#+srcname: just-show-unknown
#+begin_src ledger :cmdline reg unknown :noweb yes :session
<<data>>
#+end_src

#+results: just-show-unknown
: 08-Jan-01 UNKNOWN-PAYEE         Expenses:Unknown         -21.91 EUR   -21.91 EUR

Perfect result. That will serve as "demo".

** No output
   :PROPERTIES:
   :ID:       52aa2449-0c3d-4dee-ad57-8b2e916ed501
   :END:

#+srcname: no-output
#+begin_src ledger :cmdline reg unkXXXnown :noweb yes :session
<<data>>
#+end_src

#+results: no-output

** Error neither trapped nor shown

Let's imagine I thought (which was the case at some point) I needed to enclose
the parameters between quotes:

#+srcname: quoted-params
#+begin_src ledger :cmdline "reg unknown" :noweb yes :session
<<data>>
#+end_src

#+results: quoted-params

Nothing is returned. In fact, I would expect an error to be thrown, the same
way it should when run in a shell:

#+begin_src sh
ledger -f journal.dat "reg unknown"
#+end_src

that is:

: ~>ledger -f journal.dat "reg unknown"
: Error: Unrecognized command 'reg unknown'
: 
: ~>echo $?
: 1

Here, the shown results is exactly the same as in the [[id:52aa2449-0c3d-4dee-ad57-8b2e916ed501][No output]] case. As if
the command ended successfully, with an empty results set...

* Observations and suggestions

I don't know if this is a common problem (to Org-Babel) or only to the Ledger
part of it, but I think *we* should somehow improve the handling of errors.

- Maybe displaying a =#+results-err= block which would be what's shown on
  =/dev/stderr=, when not void?

- And having a way to display the error code would be a plus.

Best regards,
  Seb

-- 
Sébastien Vauban


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2011-03-07 10:11 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-07 11:55 [Babel] Handling of errors when using Ledger Sébastien Vauban
2010-10-07 13:36 ` Dan Davison
2010-10-12 19:58   ` Sébastien Vauban
2010-10-13  8:04     ` Eric S Fraga
2010-11-25 16:32       ` Dan
2010-11-25 19:59         ` Bernt Hansen
2010-11-25 21:00           ` [OT] retrieving old messages [WAS] " Dan Davison
2010-11-26  0:19             ` [OT] retrieving old messages Bernt Hansen
2010-11-29  2:34             ` [OT] retrieving old messages [WAS] Re: [Babel] Handling of errors when using Ledger Matt Lundin
2010-11-29  9:14               ` [OT] retrieving old messages Sébastien Vauban
2010-11-29 14:11                 ` Matt Lundin
2010-11-25 21:13           ` [Babel] Handling of errors when using Ledger Sébastien Vauban
2010-11-25 20:03         ` Sébastien Vauban
2010-11-26  8:34         ` Eric S Fraga
2010-11-26 11:47           ` Dan Davison
2010-11-26 12:39             ` Eric S Fraga
2010-12-23 10:28               ` Dan Davison
2010-12-23 15:52                 ` Sébastien Vauban
2010-12-23 19:07                 ` Eric S Fraga
2011-03-05  0:29                   ` Dan Davison
2011-03-07  9:11                     ` Eric S Fraga
2010-11-27 22:04             ` [Babel] Piping between code blocks Was: " Eric Schulte

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).