public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Signalling error from Python filter
@ 2019-10-18 11:14 Björn Stenborg
       [not found] ` <3241f1a9-fee2-4203-a070-612fed71c963-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Björn Stenborg @ 2019-10-18 11:14 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1671 bytes --]

Hi! I'm trying to figure out how best to signal errors from a Python Pandoc 
filter. If I detect that something goes wrong during filter execution, the 
goal is to print a descriptive error message to the console and then return 
an error indication. Unfortunately I can't figure out how to pass that 
through Pandoc.

I could either let my filter print the error to the console and then signal 
back to Pandoc that document generation should be aborted, or if possible 
return an error message to Pandoc and have Pandoc propagate it up to the 
script calling the pandoc binary. But throwing an exception containing the 
error message leaves me with a not very user-friendly call trace in the 
console that obscures the real error message. I can't find any real 
documentation of error codes produced by Pandoc and my Haskell skills are 
atrocious so I'm having a hard time reading the code I'm afraid.

I have an ugly workaround in embedding the error message within a custom 
"tag" in the generated document and then having the document generation 
script outside pandoc look for that tag in the generated document and 
present the error message that it contains and report the document 
generation as failed to the build system. But this is awkward.

Ideas?

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/3241f1a9-fee2-4203-a070-612fed71c963%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 2082 bytes --]

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

end of thread, other threads:[~2019-10-21  5:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-18 11:14 Signalling error from Python filter Björn Stenborg
     [not found] ` <3241f1a9-fee2-4203-a070-612fed71c963-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-10-18 17:36   ` BPJ
     [not found]     ` <CADAJKhDQz69H7Htx5muDPPB77C6uC=fQnhkmTz2fqXhVE_7Y5Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-10-21  5:42       ` John MacFarlane
2019-10-19  7:13   ` Kolen Cheung

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 NNTP newsgroup(s).