From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <eg@gaute.vetsj.com>
Received: from localhost (localhost [127.0.0.1])
	by olra.theworths.org (Postfix) with ESMTP id 10AF6431FBC
	for <notmuch@notmuchmail.org>; Thu, 21 Aug 2014 02:01:20 -0700 (PDT)
X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
X-Spam-Flag: NO
X-Spam-Score: -0.7
X-Spam-Level: 
X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
	tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
Received: from olra.theworths.org ([127.0.0.1])
	by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id wczr6v2KOVrd for <notmuch@notmuchmail.org>;
	Thu, 21 Aug 2014 02:01:12 -0700 (PDT)
Received: from mail-qg0-f49.google.com (mail-qg0-f49.google.com
	[209.85.192.49]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
	(No client certificate requested)
	by olra.theworths.org (Postfix) with ESMTPS id 0E6A7431FAF
	for <notmuch@notmuchmail.org>; Thu, 21 Aug 2014 02:01:12 -0700 (PDT)
Received: by mail-qg0-f49.google.com with SMTP id j107so8374294qga.8
	for <notmuch@notmuchmail.org>; Thu, 21 Aug 2014 02:01:10 -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:date
	:message-id:subject:from:to:content-type;
	bh=SY6FH7tiBKDH4pivZs4H+O65nntus9ylO39RjGKHvhQ=;
	b=T2OHJUxE5C6aK+0+M7lZuEz/n6QOXN6McGsg6jZ/CW+K924ppkeQn3BaxBIpf7NZPH
	eWb++cNUQyfGrNB9P/KOYIQ74Mp3x4/p9oiENIAQ/uO/tWyZsKElR/tzw5feBk9u+hdJ
	9k4cieF4QdPgHAKOuqQ5NDvWbR95w9aS5O8s/g7VPNSETI85/Z5fQqonvs8W8eDPl3mF
	qDB3FautXuMorRxqe5yfon/VUsM6kGaI2o2E6ytZEIC5+TSgdqlHjs+xKxUhm9TzZzl5
	3TccgL62NgsOSFts5U0fUpTMeBA0R834uvEIHmCFtSt2Rfu1ZJYjWjDFR0gdh8oQQYKb
	esyg==
X-Gm-Message-State: ALoCoQkV5uApY+27YOdlv+ttx04Fgp2EP8yFm6FDk0hFcGlBatrPD0AyNAvcr6AOhx6aD/+95CcI
MIME-Version: 1.0
X-Received: by 10.140.102.142 with SMTP id w14mr80976220qge.101.1408611670062; 
	Thu, 21 Aug 2014 02:01:10 -0700 (PDT)
Received: by 10.96.88.40 with HTTP; Thu, 21 Aug 2014 02:01:09 -0700 (PDT)
In-Reply-To: <1408610770-astroid-0-4on2jlyj8n-28086@strange>
References: <CABKe4MvEdcsq8BZ-vq6R0Vnw87zEgBvqW_2F-Wysf5GNchqweg@mail.gmail.com>
	<1408610770-astroid-0-4on2jlyj8n-28086@strange>
Date: Thu, 21 Aug 2014 11:01:09 +0200
Message-ID: <CABKe4MsspOoNOE+2_us+FcjxbRtMMsnY1k19hfSrff4oqHdFmw@mail.gmail.com>
Subject: Re: DatabaseModifiedErrors causing troubles
From: Gaute Hope <eg@gaute.vetsj.com>
To: notmuch <notmuch@notmuchmail.org>
Content-Type: multipart/mixed; boundary=001a11c163e038ca1a05011ff64a
X-BeenThere: notmuch@notmuchmail.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: "Use and development of the notmuch mail system."
	<notmuch.notmuchmail.org>
List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
	<mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
List-Archive: <http://notmuchmail.org/pipermail/notmuch>
List-Post: <mailto:notmuch@notmuchmail.org>
List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
	<mailto:notmuch-request@notmuchmail.org?subject=subscribe>
X-List-Received-Date: Thu, 21 Aug 2014 09:01:20 -0000

--001a11c163e038ca1a05011ff64a
Content-Type: text/plain; charset=UTF-8

On Thu, Aug 21, 2014 at 10:59 AM, Gaute Hope <eg@gaute.vetsj.com> wrote:
> For portability I would suggest starting to move towards the GError
> scheme provided by glib (also used by gmime). This is a somewhat major
> effort though since ensuring that error propagation is done right [0] is
> somewhat tricky. It provides more or less the same functionality as
> exceptions do in C++.
>
> There is also the problem of having to change the API - one way to avoid
> that is to create wrappers that behave like the old API, but don't
> handle errors that good. This requires the addition of addiontal _error
> variations of the current set of functions. It will be a mess.
>
> [0] https://developer.gnome.org/glib/stable/glib-Error-Reporting.html

Here's a quick mockup of how that could look.

Cheers, Gaute

--001a11c163e038ca1a05011ff64a
Content-Type: text/x-patch; charset=US-ASCII; 
	name="0001-mockup-Illustration-of-GError-for-error-reporting.patch"
Content-Disposition: attachment; 
	filename="0001-mockup-Illustration-of-GError-for-error-reporting.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_hz3v0kjf0

RnJvbSBlYjQ5ZTMxMWUzMTJhNWM5NTEwY2EyNGRlYzI0YWQxYzYwYWVkZWU5IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBHYXV0ZSBIb3BlIDxlZ0BnYXV0ZS52ZXRzai5jb20+CkRhdGU6
IFRodSwgMjEgQXVnIDIwMTQgMTA6NTY6NTcgKzAyMDAKU3ViamVjdDogW1BBVENIXSBtb2NrdXA6
IElsbHVzdHJhdGlvbiBvZiBHRXJyb3IgZm9yIGVycm9yIHJlcG9ydGluZwoKLS0tCiBsaWIvZGF0
YWJhc2UuY2MgfCAyMyArKysrKysrKysrKysrKysrKysrKystLQogbGliL25vdG11Y2guaCAgIHwg
NDggKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrCiAyIGZp
bGVzIGNoYW5nZWQsIDY5IGluc2VydGlvbnMoKyksIDIgZGVsZXRpb25zKC0pCgpkaWZmIC0tZ2l0
IGEvbGliL2RhdGFiYXNlLmNjIGIvbGliL2R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