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: 29.0.50; sqlite-select does not signal errors and errors should be improved Date: Sun, 09 Oct 2022 00:47:24 +0200 Message-ID: <871qrivsoz.fsf@bernoul.li> References: <87mta7lb3o.fsf@bernoul.li> <87k05asa8w.fsf@gnus.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="33723"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58363@debbugs.gnu.org, Eli Zaretskii To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 09 00:48:27 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 1ohIcM-0008aM-Lp for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 09 Oct 2022 00:48:26 +0200 Original-Received: from localhost ([::1]:51494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ohIcL-0001pe-El for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 08 Oct 2022 18:48:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41492) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohIby-0001nd-PF for bug-gnu-emacs@gnu.org; Sat, 08 Oct 2022 18:48:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42525) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ohIby-0006sg-FZ for bug-gnu-emacs@gnu.org; Sat, 08 Oct 2022 18:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ohIby-00059M-Af for bug-gnu-emacs@gnu.org; Sat, 08 Oct 2022 18:48: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, 08 Oct 2022 22:48: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.166526925119654 (code B ref 58363); Sat, 08 Oct 2022 22:48:02 +0000 Original-Received: (at 58363) by debbugs.gnu.org; 8 Oct 2022 22:47:31 +0000 Original-Received: from localhost ([127.0.0.1]:41603 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohIbS-00056w-O8 for submit@debbugs.gnu.org; Sat, 08 Oct 2022 18:47:31 -0400 Original-Received: from mail.hostpark.net ([212.243.197.30]:57756) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohIbP-00056m-G3 for 58363@debbugs.gnu.org; Sat, 08 Oct 2022 18:47:29 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id B491016910; Sun, 9 Oct 2022 00:47:24 +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=1665269244; bh=uYM58HPyox5N5a9djoufZiPA bv4fy6QsmhcZvKDFrw0=; b=uX2gvfqKjQv5EFz/ziQec4A10noKo3z4cSaPMxJq O6RxrRKNXuC85MycxjhB47ZI9wtIof5l1VGrkOHDx6dPz/BC3OdnQNEvsVjTmkdd RdQcROtATlFbsNJUAfVUzh3O5998A0ZfRbc0BmotPkQIreFIoDGX0ongnOmglRYW npA= 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 Q6Wyqn1UwDNI; Sun, 9 Oct 2022 00:47:24 +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 7D3C8163CB; Sun, 9 Oct 2022 00:47:24 +0200 (CEST) In-Reply-To: <87k05asa8w.fsf@gnus.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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:244941 Archived-At: Lars Ingebrigtsen writes: > Jonas Bernoulli writes: > >> sqlite-select does not signal any errors. This just returns nil for >> example: >> >> (sqlite-select (sqlite-open nil) "SELECT * FROM no_such_table") >> >> At least some of the other functions do signal errors when appropriate. > > I've now made this signal an error: > > Debugger entered--Lisp error: (error "SQL logic error") Thanks, but what about my suggestion to use a dedicated signal? (Suggesting that different signals be used for different error codes, may have been a bit excessive though.) More importantly though, please also include the actual error message from SQLite in the error data. Currently only a string is included, which represents the _kind_ of error that occurred, something like "SQL logic error". Unfortunately that only tells the user that they made a mistake when writing their SQL. When using pekingduck's module or EmacSQL's custom binary, the error data includes the error code and the error message, such as the very useful "no such table: missing". Please include the message in the error data. Including the error code would also be useful as that would make it easier to look it up at https://www.sqlite.org/rescode.html. I am adding two new SQLite backends to EmacSQL, one using the module and the other using the new builtin support. Currently (emacsql (emacsql-sqlite nil) "SELECT * FROM missing") and (emacsql (emacsql-sqlite-module nil) "SELECT * FROM missing") both signal (emacsql-error "no such table: nono" 1) and I considering extending that to (emacsql-error "no such table: nono" 1 "SQL logic error") However, the best I can do for (emacsql (emacsql-sqlite-builtin nil) "SELECT * FROM missing") is (emacsql-error nil 1 "SQL logic error")