From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1NlEJB-00043i-Dd for garchives@archives.gentoo.org; Sat, 27 Feb 2010 04:29:44 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8D80CE09EB; Sat, 27 Feb 2010 04:29:10 +0000 (UTC) Received: from mail-gy0-f181.google.com (mail-gy0-f181.google.com [209.85.160.181]) by pigeon.gentoo.org (Postfix) with ESMTP id 6CE00E09EB for ; Sat, 27 Feb 2010 04:29:10 +0000 (UTC) Received: by gyg4 with SMTP id 4so370384gyg.40 for ; Fri, 26 Feb 2010 20:29:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:date:from:to:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=BHOsNFgaAHCd3sOWhaZaLSDtjKiJNsqvjI3iu3GgHkU=; b=mXsOuPqypvK9e4VTC4hfC09Uz8BL22gfJIlnsW/hChlffH/OXBisTrJ+S7vsU7l9+C 9tvaPkdXHJkrGJgp0rhhihWOy0bquidYeo4DSa9KGS8ZH6wKVAzMXhkwPP7JX0wH1KK5 MBVZ8C91ITPHWsDNT77SnESnC+PvNQgo9w1fc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=YKJJUJP4AvC8tZhOr2wM3CG0PzxEpYZUazk4V8GUC6RM9rvnOz8LfA2cg/ELm1Yu/Z qr53UvyurbzfqWKKeqTG8N1cJnbUhflt+Wf9hcC4HX+qdVLFcK2jtnVQAmo2YTrEBxEc GEoCjnop1ZvdqIldF0t8Qxdu4HEd4wL9t5low= Received: by 10.91.52.20 with SMTP id e20mr1288064agk.47.1267244950106; Fri, 26 Feb 2010 20:29:10 -0800 (PST) Received: from smtp.gmail.com (c-98-210-130-131.hsd1.ca.comcast.net [98.210.130.131]) by mx.google.com with ESMTPS id 8sm298481yxb.25.2010.02.26.20.29.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 26 Feb 2010 20:29:09 -0800 (PST) Received: by smtp.gmail.com (sSMTP sendmail emulation); Fri, 26 Feb 2010 20:27:17 -0800 Date: Fri, 26 Feb 2010 20:27:17 -0800 From: Brian Harring To: gentoo-portage-dev@lists.gentoo.org Subject: Re: [gentoo-portage-dev] Composite exceptions? Message-ID: <20100227042717.GC6254@hrair> References: <4B888D77.3030104@gentoo.org> <4B888F89.9040407@gentoo.org> <4B88994A.2070707@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FCuugMFkClbJLl1L" Content-Disposition: inline In-Reply-To: <4B88994A.2070707@gentoo.org> User-Agent: Mutt/1.5.20 (2009-06-14) X-Archives-Salt: 25a7d821-1b7c-414e-8786-0ba102d736e0 X-Archives-Hash: 358f39e0c82e3ee1161374df1205c4f2 --FCuugMFkClbJLl1L Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Feb 27, 2010 at 05:02:18AM +0100, Sebastian Pipping wrote: > On 02/27/10 04:20, Zac Medico wrote: > > Do you have an example case where you want to use this? >=20 > Multiple defects in metadata.xml are such a case. > At some point all the exceptions will have to collected, e.g. two > invalid herds are mentioned. In that case a single exception with a > list of invalid herds may suffice but it gets worse when combining > errors of slightly different types. I'd suggest looking at pchecks design instead of trying to do=20 composite exceptions- essentially pass in a reporter that is invoked=20 w/ the failure/'exception' instead passed in. Doing what you're suggesting (catching all exceptions at the top and=20 trying sum them essentially) results in screwy code flow in the=20 specific check- consider a check that can flag multiple issues. =20 Chucking an exception means you get the first warning spotted (and=20 just that). Do the reporter/observer/tweaked visitor approach, you get all of the=20 issues, and it's left to the reporter to decide what to output (and=20 how to format it). Also makes it a helluva lot easier to serialize the results into=20 pickles, or go parallel (multiple processes running, the reporter=20 in the subprocess just serializes the issue to a central process that=20 then amalgamates the results). ~harring --FCuugMFkClbJLl1L Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.13 (GNU/Linux) iEYEARECAAYFAkuInyUACgkQsiLx3HvNzgcZFACgijFNmUa0qU0fltjAuN/BfKdl ctkAoLTxhyq0onO4OpmbbVLemME6408k =NN/v -----END PGP SIGNATURE----- --FCuugMFkClbJLl1L--