public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
To: BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: Signalling error from Python filter
Date: Sun, 20 Oct 2019 22:42:59 -0700	[thread overview]
Message-ID: <m2k18yu00s.fsf@johnmacfarlane.net> (raw)
In-Reply-To: <CADAJKhDQz69H7Htx5muDPPB77C6uC=fQnhkmTz2fqXhVE_7Y5Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>


This is correct. Print to stderr -- that will be passed on -- and
return an error status (non-0).  Then pandoc will, in addition,
indicate that the filter failed and exit with an error status.

BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> 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 <bjorn.stenborg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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
>> <https://groups.google.com/d/msgid/pandoc-discuss/3241f1a9-fee2-4203-a070-612fed71c963%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
> -- 
> 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.

-- 
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/m2k18yu00s.fsf%40johnmacfarlane.net.


  parent reply	other threads:[~2019-10-21  5:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18 11:14 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 [this message]
2019-10-19  7:13   ` Kolen Cheung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2k18yu00s.fsf@johnmacfarlane.net \
    --to=jgm-tvlzxgkolnx2fbvcvol8/a@public.gmane.org \
    --cc=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).