From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jonas Bernoulli Newsgroups: gmane.emacs.bugs Subject: bug#58363: [PATCH 3/3] Improve error data signaled by sqlite-execute et al. Date: Sat, 22 Oct 2022 13:07:15 +0200 Message-ID: <87y1t8qfq4.fsf@bernoul.li> References: <87v8orky2u.fsf@gnus.org> <20221021210636.13329-1-jonas@bernoul.li> <20221021210636.13329-4-jonas@bernoul.li> <83bkq4uzde.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19444"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58363@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 22 13:22:46 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1omCaU-0004pw-8b for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 Oct 2022 13:22:46 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1omCMJ-0006PM-5p; Sat, 22 Oct 2022 07:08:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omCMG-0006H8-PK for bug-gnu-emacs@gnu.org; Sat, 22 Oct 2022 07:08:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1omCME-0000hF-Ou for bug-gnu-emacs@gnu.org; Sat, 22 Oct 2022 07:08:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1omCME-00014r-By for bug-gnu-emacs@gnu.org; Sat, 22 Oct 2022 07:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jonas Bernoulli Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Oct 2022 11:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58363 X-GNU-PR-Package: emacs Original-Received: via spool by 58363-submit@debbugs.gnu.org id=B58363.16664368424095 (code B ref 58363); Sat, 22 Oct 2022 11:08:02 +0000 Original-Received: (at 58363) by debbugs.gnu.org; 22 Oct 2022 11:07:22 +0000 Original-Received: from localhost ([127.0.0.1]:39790 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omCLa-00013y-Gc for submit@debbugs.gnu.org; Sat, 22 Oct 2022 07:07:22 -0400 Original-Received: from mail.hostpark.net ([212.243.197.30]:58062) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omCLW-00013o-H5 for 58363@debbugs.gnu.org; Sat, 22 Oct 2022 07:07:20 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 6EA65163CB; Sat, 22 Oct 2022 13:07:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from:received :received; s=sel2011a; t=1666436836; bh=QP4yd/HtfDgaafR9FsjX2To9 lcCJKzcFCzhknsymIHY=; b=gNFydv7P2Ibl6PCZ0yYC5xjgAT78QhQPcxIyDvku mJsuMknmW6o+fnhV6iIBiily6cCj+QmcCfSR3WiOf3x7N6U2DhznJhWQjRUO2SMb j6evJ07jS7dil7iAEJp8dtBO97LhUvHd852OUX9Ybjds8qaXDlernWaLnJVWAq1z +BE= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Original-Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id R8iyfy6lI8w4; Sat, 22 Oct 2022 13:07:16 +0200 (CEST) Original-Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 3DBD6162AB; Sat, 22 Oct 2022 13:07:16 +0200 (CEST) In-Reply-To: <83bkq4uzde.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246034 Archived-At: Eli Zaretskii writes: >> From: Jonas Bernoulli >> Date: Fri, 21 Oct 2022 23:06:36 +0200 >> >> + Lisp_Object ext_errcode = make_fixnum (sqlite3_extended_errcode (sdb)); >> + const char *errmsg = sqlite3_errmsg (sdb); >> + return list4 (errstr, errmsg ? build_string (errmsg) : Qnil, >> + errcode, ext_errcode); ^^^^ > > Is that Qnil really a good idea here? What will an error message look > like in that case? We may wish replacing Qnil with some standard > text, if it looks better. Based on some data I collected from SQLite documentation and code, this is only relevant in some rare cases: ((1 SQLITE_ERROR "SQL logic error") (2 SQLITE_INTERNAL nil) (3 SQLITE_PERM "access permission denied") (4 SQLITE_ABORT "query aborted") (5 SQLITE_BUSY "database is locked") (6 SQLITE_LOCKED "database table is locked") (7 SQLITE_NOMEM "out of memory") (8 SQLITE_READONLY "attempt to write a readonly database") (9 SQLITE_INTERRUPT "interrupted") (10 SQLITE_IOERR "disk I/O error") (11 SQLITE_CORRUPT "database disk image is malformed") (12 SQLITE_NOTFOUND "unknown operation") (13 SQLITE_FULL "database or disk is full") (14 SQLITE_CANTOPEN "unable to open database file") (15 SQLITE_PROTOCOL "locking protocol") (16 SQLITE_EMPTY nil) (17 SQLITE_SCHEMA "database schema has changed") (18 SQLITE_TOOBIG "string or blob too big") (19 SQLITE_CONSTRAINT "constraint failed") (20 SQLITE_MISMATCH "datatype mismatch") (21 SQLITE_MISUSE "bad parameter or other API misuse") (22 SQLITE_NOLFS "large file support is disabled") (23 SQLITE_AUTH "authorization denied") (24 SQLITE_FORMAT nil) (25 SQLITE_RANGE "column index out of range") (26 SQLITE_NOTADB "file is not a database") (27 SQLITE_NOTICE "notification message") (28 SQLITE_WARNING "warning message")) We would get nil for SQLITE_INTERNAL ("internal malfunction ... application should never see this"), SQLITE_EMPTY ("not currently used"), and SQLITE_FORMAT ("not currently used"). The comments in parentheses are from https://www.sqlite.org/rescode.html. We will "never" see these error codes, and if we do see 2/SQLITE_INTERNAL, it is IMO okay if the shown error is a bit ugly.