Have you tried to just throw an exception or print a message to stderr? As far as I know pandoc will forward it to its own stderr in an orderly manner, unless the python filter library you are using does something funny. Den fre 18 okt. 2019 13:15Björn Stenborg skrev: > 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 > > . > -- 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/CADAJKhDQz69H7Htx5muDPPB77C6uC%3DfQnhkmTz2fqXhVE_7Y5Q%40mail.gmail.com.