Subject: bug#33407: closed (Re: bug#33407: Cuirass is dropping the SQLite error message when rethrowing)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 16 Nov 2018 20:53:02 +0000

Your bug report

#33407: Cuirass is dropping the SQLite error message when rethrowing

which was filed against the guix package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
33407: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=33407
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#33407: Cuirass is dropping the SQLite error message when rethrowing
From: [email-masked] (Ludovic Courtès)
To: Björn Höfling <[email-masked]>
Cc: [email-masked]
Date: Fri, 16 Nov 2018 21:51:49 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello,

Björn Höfling <[email-masked]> skribis:

> is this a bug or by intention?
>
> In src/cuirass/database.scm, in the db-add-* procedures, we have a
> catch-clause like this:
>
> (with-db-critical-section db
>   (catch 'sqlite-error
>     (lambda ()
>       <thunk-body>)
>     (lambda (key who code message . rest)
>         ;; If we get a unique-constraint-failed error, that means we have
>         ;; already inserted the same checkout.  That happens for each input
>         ;; that doesn't change between two evaluations.
>         (if (= code SQLITE_CONSTRAINT_PRIMARYKEY)
>             #f
>             (apply throw key who code rest))))))
> -------------------------------------^
>
> Here the message is not re-thrown.
>
> It would have made my life easier if I saw this message:
>
>   "NOT NULL constraint failed: Builds.system"

Oops, good catch!  Fixed in commit
d0ed3341d7201d0332e9aeb0af80e0ec635aeb1e.

I also factorized the exception handler in the previous commit because
there were 3 copies of this bug…

Thanks!

Ludo’.

Subject: Cuirass is dropping the SQLite error message when rethrowing
From: Björn Höfling <[email-masked]>
To: <[email-masked]>
Date: Fri, 16 Nov 2018 18:43:51 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

is this a bug or by intention?

In src/cuirass/database.scm, in the db-add-* procedures, we have a
catch-clause like this:

(with-db-critical-section db
  (catch 'sqlite-error
    (lambda ()
      <thunk-body>)
    (lambda (key who code message . rest)
        ;; If we get a unique-constraint-failed error, that means we have
        ;; already inserted the same checkout.  That happens for each input
        ;; that doesn't change between two evaluations.
        (if (= code SQLITE_CONSTRAINT_PRIMARYKEY)
            #f
            (apply throw key who code rest))))))
-------------------------------------^

Here the message is not re-thrown.

It would have made my life easier if I saw this message:

  "NOT NULL constraint failed: Builds.system"

instead of just:

In cuirass/utils.scm:
   115:35  0 (_)
cuirass/utils.scm:115:35: Throw to key `sqlite-error' with args `(#f 1299)'.

Addationally, when adding the message to the apply clause, at least in
an isolated test it will be just thrown without problems.

Björn