From: "Stéphane Glondu" <steph@glondu.net>
To: oliver <oliver@first.in-berlin.de>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Fatal error: exception Pcre.Error(0)
Date: Thu, 22 Dec 2011 23:35:41 +0100 [thread overview]
Message-ID: <4EF3B0BD.7040900@glondu.net> (raw)
In-Reply-To: <20111222213956.GA8513@siouxsie>
Le 22/12/2011 22:39, oliver a écrit :
>>> where is there a documentation about these kind of errors from pcre-lib?
>>> I'm using Pcre.pmatch, which should just give me a bool.
>>
>> See pcre.mli. Pcre.Error(0) is the raw representation of Partial (i.e.
>> string only matched the pattern partially).
> [...]
>
> In my pcre.mli this error is not mentioned.
>
> There is a
>
>
> type error =
> | Partial (** String only matched the pattern partially *)
^^^^^^^
There.
> Which also mentioned a partial-match error.
> But Pcre.Error(0) looks somehow cryptical
> and strange to me.
Pcre.Error(0) is cryptical but not strange: it is the same as
Pcre.Error(Pcre.Partial). Whatever gives you the error message
mentioning Pcre.Error(0) does not have access to type information, so it
cannot give you more than Pcre.Error(0). You didn't tell where the error
message came from.
>> By the way, in doubt, you can catch Pcre.Error and pattern-match on its
>> argument.
>
> Yes, I think that makes sense.
> But Pcre.Error(0) is not very verbose, and I also want to know
> what I catch and why...
try Pcre.exec ...
with Pcre.Error e ->
match e with
| Partial -> ...
| _ -> ...
If you are using the generic exception pretty-printer (module Printexc),
you can register a pretty-printer for Pcre.Error with
Printexc.register_printer.
> Installing a newer pcre was easy, but then my build process complains
> about multiple stublibs-directories. So I threw it away.
> So maybe it's better to change the apt-get stuff instead.
The only way a new version of pcre could "fix" that would be if it
registered a pretty-printer as explained above. But this is not the
case, even in the last version (6.2.4).
Cheers,
--
Stéphane
next prev parent reply other threads:[~2011-12-22 22:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-22 18:39 oliver
2011-12-22 18:50 ` oliver
2011-12-22 19:53 ` Stéphane Glondu
2011-12-22 21:39 ` oliver
2011-12-22 22:35 ` Stéphane Glondu [this message]
2011-12-23 0:13 ` oliver
2011-12-23 3:35 ` Abdallah Saffidine
2011-12-23 6:29 ` Stéphane Glondu
2011-12-23 12:59 ` Pcre-Ocaml-docs (Re: [Caml-list] Fatal error: exception Pcre.Error(0)) oliver
2011-12-23 0:45 ` [Caml-list] Fatal error: exception Pcre.Error(0) oliver
2011-12-23 1:21 ` oliver
2011-12-23 2:09 ` Markus Mottl
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=4EF3B0BD.7040900@glondu.net \
--to=steph@glondu.net \
--cc=caml-list@inria.fr \
--cc=oliver@first.in-berlin.de \
/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