From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id A42DF7F75C for ; Sun, 14 Sep 2014 00:53:47 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of blg59@cornell.edu) identity=pra; client-ip=209.85.217.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="blg59@cornell.edu"; x-sender="blg59@cornell.edu"; x-conformance=sidf_compatible Received-SPF: Neutral (mail2-smtp-roc.national.inria.fr: domain of blg59@cornell.edu does not assert whether or not 209.85.217.172 is permitted sender) identity=mailfrom; client-ip=209.85.217.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="blg59@cornell.edu"; x-sender="blg59@cornell.edu"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-lb0-f172.google.com) identity=helo; client-ip=209.85.217.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="blg59@cornell.edu"; x-sender="postmaster@mail-lb0-f172.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoUDAFzKFFTRVdmsm2dsb2JhbABfg2BXBIJ4gRytewaCbJJHgWuHTgGBAAgWEAEBAQEBBgsLCRQqhAQBAQMBEhEERwsFCwkCBAcaHQICIhIBBQEKEgYTEhCICAMJCA2KQpAqa4swjhYDYYYeARcKhXKJTQQHgniBUwWFDQWQcocEgV+RbhgpgnkfHoF1IS8BgkkBAQE X-IPAS-Result: AoUDAFzKFFTRVdmsm2dsb2JhbABfg2BXBIJ4gRytewaCbJJHgWuHTgGBAAgWEAEBAQEBBgsLCRQqhAQBAQMBEhEERwsFCwkCBAcaHQICIhIBBQEKEgYTEhCICAMJCA2KQpAqa4swjhYDYYYeARcKhXKJTQQHgniBUwWFDQWQcocEgV+RbhgpgnkfHoF1IS8BgkkBAQE X-IronPort-AV: E=Sophos;i="5.04,519,1406584800"; d="scan'208";a="94729277" Received: from mail-lb0-f172.google.com ([209.85.217.172]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 14 Sep 2014 00:53:46 +0200 Received: by mail-lb0-f172.google.com with SMTP id w7so2701695lbi.3 for ; Sat, 13 Sep 2014 15:53:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=N4w9HAqkx5JBdJedj5FxyXweflXoVr4VDNLPrUsCkyo=; b=lzde9aNP6o265CvG9sGmfNZF4sCcLueOM9dUuGINjTvk/0qYu/5tBISOUeL4WBPaMU y4ANHqLLKuanWs/CnOUlrDq+jET5HckBuqfk3XjImUMasTzVqCByFPQdNd+qFp3HlLCX 4tNH/APrUF5wegJICuR8opkrfuVaBIhEgd42Hy5lxuTndAx0VrHT6WNpw60nbuKRvyYL tKAWFvZEoM4SHwEUfVXBQGZVP1s6WpZ9uVFfJs7BRbiojpkaVzrp10imAT82MhG0C+Vp GKWrXRNa1Sp3RaS91+R7t5etSiIx9rrcUPkkIMGw72QKf8sBz7oFDXBB3FgQBpMfLR33 FTQg== X-Gm-Message-State: ALoCoQk4Fud2fIM/vS35IwSB9Lxu0/uqbswKoz/zTEnED/CpQ3tLr2Ml0GrtCA3t01SR50p/ypKd X-Received: by 10.112.171.202 with SMTP id aw10mr877882lbc.52.1410648826194; Sat, 13 Sep 2014 15:53:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.202.232 with HTTP; Sat, 13 Sep 2014 15:53:26 -0700 (PDT) In-Reply-To: <20140914004715.Horde.0vNRgNUsRsqsjnX3ZDjGPQ9@webmail.in-berlin.de> References: <20140914004715.Horde.0vNRgNUsRsqsjnX3ZDjGPQ9@webmail.in-berlin.de> From: Benjamin Greenman Date: Sat, 13 Sep 2014 18:53:26 -0400 Message-ID: To: Oliver Bandel Cc: OCaml mailing-list Content-Type: multipart/alternative; boundary=001a11c36b223037800502fa4647 Subject: Re: [Caml-list] With String.sub I need to catch "Bytes.sub" exception --001a11c36b223037800502fa4647 Content-Type: text/plain; charset=UTF-8 Why do you match on the error string? String.sub is only documented to raise "Invalid_argument _". http://caml.inria.fr/pub/docs/manual-ocaml/libref/String.html On Sat, Sep 13, 2014 at 6:47 PM, Oliver Bandel wrote: > Hello, > > is this a known bug? > > Needed to change code from > > with Invalid_argument("Strings.sub") > to > with Invalid_argument("Bytes.sub") > > The code now looks like this and then works again: > > > try > if parser_url_len > 0 && parser_url = String.sub url 0 > parser_url_len then parser_name else aux tl > with Invalid_argument("Bytes.sub") -> aux tl (* this > happens if url is shorter than parser_url *) > > > Ciao, > Oliver > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > --001a11c36b223037800502fa4647 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Why do you match on the error string? String.sub is only d= ocumented to raise "Invalid_argument _".

=

On Sat, Sep 13, 2= 014 at 6:47 PM, Oliver Bandel <oliver@first.in-berlin.de> wrote:
Hello,

is this a known bug?

Needed to change code from

=C2=A0 =C2=A0with Invalid_argument("Strings.sub")
to
=C2=A0 =C2=A0with Invalid_argument("Bytes.sub")

The code now looks like this and then works again:


=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 try
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if pa= rser_url_len > 0 && parser_url =3D String.sub url 0 parser_url_l= en then parser_name else aux tl
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 with Invalid= _argument("Bytes.sub") -> aux tl (* this happens if url is sho= rter than parser_url *)


Ciao,
=C2=A0 =C2=A0Oliver


--
Caml-list mailing list.=C2=A0 Subscription management and archives:
ht= tps://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners<= /a>
Bug reports:
http://caml.inria.fr/bin/caml-bugs

--001a11c36b223037800502fa4647--