all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jonas Bernoulli <jonas@bernoul.li>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 58363@debbugs.gnu.org
Subject: bug#58363: [PATCH 3/3] Improve error data signaled by sqlite-execute et al.
Date: Sat, 22 Oct 2022 13:07:15 +0200	[thread overview]
Message-ID: <87y1t8qfq4.fsf@bernoul.li> (raw)
In-Reply-To: <83bkq4uzde.fsf@gnu.org>

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Jonas Bernoulli <jonas@bernoul.li>
>> 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.





      reply	other threads:[~2022-10-22 11:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-07 18:52 bug#58363: 29.0.50; sqlite-select does not signal errors and errors should be improved Jonas Bernoulli
2022-10-08 13:41 ` Lars Ingebrigtsen
2022-10-08 14:35   ` Eli Zaretskii
2022-10-08 14:51     ` Lars Ingebrigtsen
2022-10-08 22:47   ` Jonas Bernoulli
2022-10-09 14:18     ` Lars Ingebrigtsen
2022-10-10 10:56       ` Jonas Bernoulli
2022-10-11  0:23         ` Lars Ingebrigtsen
2022-10-14 17:52           ` Jonas Bernoulli
2022-10-21 21:06           ` bug#58363: [PATCH 0/3] Improve error data signaled by sqlite-execute et al Jonas Bernoulli
2022-10-21 21:06             ` bug#58363: [PATCH 1/3] Use xsignal1 as required by argument type Jonas Bernoulli
2022-10-22  6:45               ` Eli Zaretskii
2022-10-22 10:45                 ` Jonas Bernoulli
2022-10-22 11:45                   ` Eli Zaretskii
2022-10-22 15:32                     ` Jonas Bernoulli
2022-10-22 15:59                       ` Eli Zaretskii
2022-10-21 21:06             ` bug#58363: [PATCH 2/3] Introduce a new sqlite-error Jonas Bernoulli
2022-10-22  9:14               ` Michael Albinus
2022-10-22 10:47                 ` Jonas Bernoulli
2022-10-21 21:06             ` bug#58363: [PATCH 3/3] Improve error data signaled by sqlite-execute et al Jonas Bernoulli
2022-10-22  6:49               ` Eli Zaretskii
2022-10-22 11:07                 ` Jonas Bernoulli [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1t8qfq4.fsf@bernoul.li \
    --to=jonas@bernoul.li \
    --cc=58363@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.