caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gerd Stolpmann <info@gerd-stolpmann.de>
To: gaurav_chanda@lycos.com
Cc: caml-list@pauillac.inria.fr
Subject: Re: [Caml-list] PXP
Date: Wed, 5 Jun 2002 00:53:38 +0200	[thread overview]
Message-ID: <20020605005338.A623@ice.gerd-stolpmann.de> (raw)
In-Reply-To: <IICHGOGGMCFCMAAA@mailcity.com>; from gaurav_chanda@lycos.com on Tue, Jun 04, 2002 at 18:19:08 +0200


On 2002.06.04 18:19 Gaurav Chanda wrote:
> Hello
> 
> I am using PXP to parse and validate an XML document. The follwing code 	
> 
> 
> <?xml version="1.0"?>
> <methodCall>
>   <methodName>examples.getStateName</methodName>
>   <params>
>     <param>
>       <value><i4>41</i4></value>
>       </param>
>     </params>
>   </methodCall>
> 
> gave this error at runtime: 
>   Fatal error: exception Pxp_types.At("In entity [toplevel] = ANONYMOUS, at line 2, position 12:", _)
> 
> Could anybody help me solve this problem ?

In addition to Stefano's answer: Unfortunately, you do not get the full error message. 
This is an annoying problem of the runtime environment. Try the following code in the 
toploop:

# raise(At("x",WF_error "y"));;
Exception: Pxp_types.At ("x", Pxp_types.WF_error "y").
# try raise(At("x",WF_error "y")) with any -> Failure(Printexc.to_string any);;
- : exn = Failure "Pxp_types.At(_)"
 
If you compile raise(At("x",WF_error "y")), and start the program, you get a third 
variant:

Fatal error: exception Pxp_types.At("x", _)

There are three different built-in routines to print uncaught exceptions, and all three
have different capabilitites, and only one can print nested exceptions.

The workaround for PXP is to use the special exception printer Pxp_types.string_of_exn
like

try
  <your code raising the exception>
with
  error ->
    failwith(Pxp_types.string_of_exn error)

and you get always an exception that can be printed, regardless which printer happens
to catch the exception.

Gerd
-- 
----------------------------------------------------------------------------
Gerd Stolpmann      Telefon: +49 6151 997705 (privat)
Viktoriastr. 45             
64293 Darmstadt     EMail:   gerd@gerd-stolpmann.de
Germany                     
----------------------------------------------------------------------------
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  parent reply	other threads:[~2002-06-04 22:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-04 16:19 Gaurav Chanda
2002-06-04 19:55 ` Stefano Zacchiroli
2002-06-04 22:53 ` Gerd Stolpmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-06-24  8:58 Alessandro Baretta
2002-06-24  9:06 ` Stefano Zacchiroli
2002-06-24  9:14 ` Claudio Sacerdoti Coen
2002-06-24  9:23   ` Alessandro Baretta
2002-05-31 15:58 Gaurav Chanda
2002-05-31 16:12 ` Gerd Stolpmann

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=20020605005338.A623@ice.gerd-stolpmann.de \
    --to=info@gerd-stolpmann.de \
    --cc=caml-list@pauillac.inria.fr \
    --cc=gaurav_chanda@lycos.com \
    /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).