From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id A29CE7EE6B for ; Mon, 2 Dec 2013 16:15:23 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of milanst@gmail.com) identity=pra; client-ip=209.85.223.181; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="milanst@gmail.com"; x-sender="milanst@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of milanst@gmail.com designates 209.85.223.181 as permitted sender) identity=mailfrom; client-ip=209.85.223.181; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="milanst@gmail.com"; x-sender="milanst@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ie0-f181.google.com) identity=helo; client-ip=209.85.223.181; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="milanst@gmail.com"; x-sender="postmaster@mail-ie0-f181.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ar8CAMKjnFLRVd+1lGdsb2JhbABZDoMxU4J6tWmBHQgWDgEBAQEHCwsJEiqCJQEBBAEjBBkBCxAdAQMBCwYFCwgHAiYCAiIBAg8BBQEcBogBAQMJAgSjcowGU4MJgQWDLwoZJw1khlARAQUMgR2NLDMHgmuBSAOJQo5SkCYYKYQWXR4 X-IPAS-Result: Ar8CAMKjnFLRVd+1lGdsb2JhbABZDoMxU4J6tWmBHQgWDgEBAQEHCwsJEiqCJQEBBAEjBBkBCxAdAQMBCwYFCwgHAiYCAiIBAg8BBQEcBogBAQMJAgSjcowGU4MJgQWDLwoZJw1khlARAQUMgR2NLDMHgmuBSAOJQo5SkCYYKYQWXR4 X-IronPort-AV: E=Sophos;i="4.93,811,1378850400"; d="scan'208";a="38942050" Received: from mail-ie0-f181.google.com ([209.85.223.181]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 02 Dec 2013 16:15:23 +0100 Received: by mail-ie0-f181.google.com with SMTP id e14so20309689iej.26 for ; Mon, 02 Dec 2013 07:15:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=2LwDWMvNBwoOkvho7aOe6FLteBSsBNUsX/9XsRtwUfY=; b=EkNnK60HxruXgVa9WTWSzsqVonegcl6BQpooGVMNHibgKc2j/oozdOrqvCEQgl/EdJ jTp+OC/tmYnC9luez2jJgd+4Co80vJ50UTY4/XO0U/plHceGIgTu4Y3zUATq55yO5Yzu /urw2Q7AMHAtYQfHbIGsVsYwYXvTfIm6MdZCL4Y5SlQVUT9NWttCxUGv6w3Eg53nXOS9 OSN9+F0qp9vfCgyMCJxgfhHR6mrTb/kX0kQUu0OUkFTM3PDYiglylcq6Uown0uBrDGMJ 5XK2pemyt+rby905S5ofSgQHrx76eoqYMeUrEPkSyyfxcDRdhQOcudacWtQUeA5SGWlN nvGQ== X-Received: by 10.50.25.129 with SMTP id c1mr18235743igg.23.1385997321811; Mon, 02 Dec 2013 07:15:21 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.63.11 with HTTP; Mon, 2 Dec 2013 07:14:41 -0800 (PST) In-Reply-To: <2405FBD1-B79A-4C23-8886-FB6A17D5F8EA@my.bristol.ac.uk> References: <96620953-9991-4976-A207-7DBB32584D57@my.bristol.ac.uk> <2405FBD1-B79A-4C23-8886-FB6A17D5F8EA@my.bristol.ac.uk> From: =?UTF-8?Q?Milan_Stanojevi=C4=87?= Date: Mon, 2 Dec 2013 10:14:41 -0500 Message-ID: To: Ollie Frolovs Cc: caml users Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Extracting exception details (Async, Cohttp, Exn) > Indeed. By saying =E2=80=9Cdescription=E2=80=9D I tried to communicate my= intention, obviously unsuccessfully. In the given example, I would like to= extract ("connection attempt timeout" 127.0.0.2:80) in some civil way, pre= ferable as a string so that i can display the error message to the user. In= RWO all examples that i have seen so far, just check for Error/None and pr= int =E2=80=9CUnexpected failure=E2=80=9D to the user (DuckDuckGo example). = I want to give more information but not the entire sexp with the backtrace,= etc. > As I said, you can use Monitor.extract_exn. try_with (fun () -> Cohttp_async.Client.get (Uri.of_string "http://127.0.0.= 2")) >>=3D function | Error exn -> let orig_exn =3D Monitor.extract_exn exn in Exn.to_string orig_exn | Ok _ -> .....