Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 86FC1200B45 for ; Fri, 15 Jul 2016 20:50:48 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 83D0D160A61; Fri, 15 Jul 2016 18:50:48 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CBFAD160A57 for ; Fri, 15 Jul 2016 20:50:47 +0200 (CEST) Received: (qmail 16242 invoked by uid 500); 15 Jul 2016 18:50:47 -0000 Mailing-List: contact dev-help@asterixdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@asterixdb.apache.org Delivered-To: mailing list dev@asterixdb.apache.org Received: (qmail 16231 invoked by uid 99); 15 Jul 2016 18:50:47 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jul 2016 18:50:47 +0000 Received: from [10.17.2.134] (unknown [206.169.106.2]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 933081A0042 for ; Fri, 15 Jul 2016 18:50:46 +0000 (UTC) From: "Till Westmann" To: dev@asterixdb.apache.org Subject: Errors, exceptions, and error codes Date: Fri, 15 Jul 2016 11:50:08 -0700 Message-ID: <785475B4-5099-4B7A-AE88-9B0544004CD3@apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailer: MailMate (1.9.4r5234) archived-at: Fri, 15 Jul 2016 18:50:48 -0000 Hi, triggered by a recent bug fix that required an non-trivial error reporting/handling workflow across the Hyracks/AsterixDB boundary, I’d like to propose a change/extension to the way we manage exceptions. The change is that we’d limit the number of exception classes to a very few (HyracksDataException for runtime errors, AlgebricksExeptions for compiler errors, maybe 1 or 2 more) and introduce error codes to identify errors further. The use of error codes has a number of advantages: 1) Error codes usually use simple types (strings or integers) and thus make it easy to be transported across system boundaries (Hyracks, AsterixDB, VXQuery, clients, …) as opposed to subclasses of exceptions that need to be available in the respective VMs. 2) Error codes (once established) make it easy for customers to search for existing solutions (try to google for e.g. "ORA-12154" [1] :) ). 3) Error codes can be used a a key for error messages in different languages (if we want to expand our reach). I’ve created en example of what this could initially look like for HyracksDataException [2]. You’ll see there that I propose to add a) a component (e.g. "Hyracks", "Hyracks Storage", "AsterixDB", …), b) an error code (that is unique within a component), and c) an array of Serializable objects to the HyracksDataException. While the component and the error code are used to uniquely identify an error, the array is used to provide additional information for an error. This information that could either be used when handling the error or when parameterizing a (potential language-specific) error message. E.g. the error message could be "%1$s does not contain %2$s" and %1 and %2 would be substituted with actual values when reporting the error. Please take a look at the proposal and reply with questions, comments, suggestions, or alternatives. Thanks, Till [1] https://www.google.com/search?q=ORA-12154 [2] https://asterix-gerrit.ics.uci.edu/#/c/1000/