Return-Path: Delivered-To: apmail-hadoop-pig-dev-archive@www.apache.org Received: (qmail 65185 invoked from network); 14 Sep 2010 19:37:58 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 14 Sep 2010 19:37:58 -0000 Received: (qmail 66742 invoked by uid 500); 14 Sep 2010 19:37:58 -0000 Delivered-To: apmail-hadoop-pig-dev-archive@hadoop.apache.org Received: (qmail 66686 invoked by uid 500); 14 Sep 2010 19:37:57 -0000 Mailing-List: contact pig-dev-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: pig-dev@hadoop.apache.org Delivered-To: mailing list pig-dev@hadoop.apache.org Received: (qmail 66678 invoked by uid 99); 14 Sep 2010 19:37:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Sep 2010 19:37:57 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Sep 2010 19:37:55 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o8EJbXFI022646 for ; Tue, 14 Sep 2010 19:37:33 GMT Message-ID: <27369497.186981284493053592.JavaMail.jira@thor> Date: Tue, 14 Sep 2010 15:37:33 -0400 (EDT) From: "Thejas M Nair (JIRA)" To: pig-dev@hadoop.apache.org Subject: [jira] Created: (PIG-1611) use enums for error code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org use enums for error code ------------------------ Key: PIG-1611 URL: https://issues.apache.org/jira/browse/PIG-1611 Project: Pig Issue Type: Sub-task Reporter: Thejas M Nair Fix For: 0.9.0 Pig code is using integer constants for error code, and the value of the error code is reserved using http://wiki.apache.org/pig/PigErrorHandlingFunctionalSpecification . This process is cumbersome and error prone. It will be better to use enum values instead. The enum value can contain the error message and encapsulate the error code. For example - {code} Replace throw new SchemaMergeException("Error in merging schema", 2124, PigException.BUG); with throw new SchemaMergeException(SCHEMA_MERGE_EX, PigException.BUG); {code} Where SCHEMA_MERGE_EX belongs to a error codes enum. We can use the ordinal value of the enum and an offset to determine the error code. The error code will be passed through the constructor of the enum. {code} SCHEMA_MERGE_EX("Error in merging schema"); {code} For documentation, the error code and error messages can be dumped using code that uses the enum error code class. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.