[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#58363: 29.0.50; sqlite-select does not signal errors and errors shou
From: |
Jonas Bernoulli |
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 |
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Jonas Bernoulli <jonas@bernoul.li> 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")
- bug#58363: 29.0.50; sqlite-select does not signal errors and errors should be improved, Jonas Bernoulli, 2022/10/07
- bug#58363: 29.0.50; sqlite-select does not signal errors and errors should be improved, Lars Ingebrigtsen, 2022/10/08
- bug#58363: 29.0.50; sqlite-select does not signal errors and errors should be improved, Eli Zaretskii, 2022/10/08
- bug#58363: 29.0.50; sqlite-select does not signal errors and errors should be improved,
Jonas Bernoulli <=
- bug#58363: 29.0.50; sqlite-select does not signal errors and errors should be improved, Lars Ingebrigtsen, 2022/10/09
- bug#58363: 29.0.50; sqlite-select does not signal errors and errors should be improved, Jonas Bernoulli, 2022/10/10
- bug#58363: 29.0.50; sqlite-select does not signal errors and errors should be improved, Lars Ingebrigtsen, 2022/10/10
- bug#58363: 29.0.50; sqlite-select does not signal errors and errors should be improved, Jonas Bernoulli, 2022/10/14
- bug#58363: [PATCH 0/3] Improve error data signaled by sqlite-execute et al., Jonas Bernoulli, 2022/10/21
- bug#58363: [PATCH 2/3] Introduce a new sqlite-error, Jonas Bernoulli, 2022/10/21
- bug#58363: [PATCH 2/3] Introduce a new sqlite-error, Michael Albinus, 2022/10/22
- bug#58363: [PATCH 2/3] Introduce a new sqlite-error, Jonas Bernoulli, 2022/10/22
- bug#58363: [PATCH 1/3] Use xsignal1 as required by argument type, Jonas Bernoulli, 2022/10/21
- bug#58363: [PATCH 1/3] Use xsignal1 as required by argument type, Eli Zaretskii, 2022/10/22