Return-Path: Delivered-To: apmail-james-mime4j-dev-archive@minotaur.apache.org Received: (qmail 6372 invoked from network); 12 Apr 2009 11:42:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Apr 2009 11:42:27 -0000 Received: (qmail 57196 invoked by uid 500); 12 Apr 2009 11:42:26 -0000 Delivered-To: apmail-james-mime4j-dev-archive@james.apache.org Received: (qmail 57169 invoked by uid 500); 12 Apr 2009 11:42:26 -0000 Mailing-List: contact mime4j-dev-help@james.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: mime4j-dev@james.apache.org Delivered-To: mailing list mime4j-dev@james.apache.org Received: (qmail 57159 invoked by uid 99); 12 Apr 2009 11:42:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Apr 2009 11:42:26 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of markus.wiederkehr@gmail.com designates 209.85.218.171 as permitted sender) Received: from [209.85.218.171] (HELO mail-bw0-f171.google.com) (209.85.218.171) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Apr 2009 11:42:20 +0000 Received: by bwz19 with SMTP id 19so2093462bwz.4 for ; Sun, 12 Apr 2009 04:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=7iJXdLMVAgCASme4xKAesaV7uMPyB10CkdVB37rajZM=; b=anZvTN5kG661I+yrnaYbpFeJ9glHVFlcqipNb4PBPshRVmnYWu6iuuOFkhqneDt+xr J1ZqNhl/y68S1p1jucwPKYURTZS7b8MPfEcgZ14Zk9Kn/V6wnk3A2IBOoUnHlLe5Ho4P +iaMBbN4Rikoyag0aIlJQuvOYo1gUosANQHdM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=gngLAm0oKjoh4R4+pc0tqhL6MgWI+4rTe8yMDcOI9Wk1FknosKPpUihlIJodOabotQ Swq87eNmQW6ZamdL9md+Rqb5LmaT9rJPyV5sXzPXVHuf8yqA1xPp2g2Jq0N4OdqWNIs/ eH3IgyvBGC7iw4NcRt/BuGaciDkntBfvOh56Q= MIME-Version: 1.0 Received: by 10.223.126.203 with SMTP id d11mr1492871fas.22.1239536518355; Sun, 12 Apr 2009 04:41:58 -0700 (PDT) In-Reply-To: References: Date: Sun, 12 Apr 2009 13:41:58 +0200 Message-ID: Subject: Re: Exception I18n...? From: Markus Wiederkehr To: mime4j-dev@james.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On Thu, Apr 9, 2009 at 5:30 PM, Robert Burrell Donkin wrote: > On Thu, Apr 9, 2009 at 11:07 AM, Markus Wiederkehr > wrote: >> On Wed, Apr 8, 2009 at 9:28 AM, Robert Burrell Donkin >> wrote: >>> ATM exceptions contain messages in english. for some upstream use >>> cases (in particular IMAP), it would be useful to be able to display >>> to the user an internationalised reasonably diagnostic message. the >>> actual i18n could be done upstream provided that this library supplied >>> more information. >> >> I am not sure if it is a good idea to confront the user with exception >> detail messages. I think details messages are often too technical for >> being of any value to the average user (no insult intended ;-). >> >> I usually handle this by only letting the user know that something >> went wrong. An administrator or technician can then look into the log >> files and see what's going on. > > i agree to some extent. there are lots of cases when that's the only solution. > > i can also understand why contacting an admin or technician is a > unnecessary cost in some cases. for example, if a field cannot be > parsed since it's badly formatted, this is just a data problem with > the email. i think this could sometimes be reasonably presented to the > user. Then we should probably try to identify the exceptions that can be presented to the user instead of adding some kind of tag or whatever to all our exceptions. And maybe what we really need is not a translation of the detail message but an exception that is self-explanatory. What I mean is an exception that contains all the information about the problem that occurred in its member fields. Like for example an IndexOutOfBoundsException that contains not only the detail message but also the minimal, maximal and actual indexes. Or in case of Mime4j a FieldParseException that contains the field name. >> But that's just my two cents.. What would you need to implement what >> you want? A unique tag for each exception? Easy for our own >> exceptions, difficult for system library exceptions.. And what about >> exception chaining? > > i'm not so concerned about system library exceptions or chained ones - > these will usually indicate something that really needs the ops to > take a look to find out what's gone wrong. something as simple as an > enumeration or tag should be good enough to allow anyone who wants to > internationalise. But chaining is a problem here. Often you have to wrap an exception A in an exception B only because the current method's contract does not permit A to be thrown. Then you would catch B and the information you are really looking for is hidden inside in A. We have this situation with MimeException and MimeIOException.. Markus