When I call find-dao 'my-model :my-slot (get-data) but (get-data) is buggy and returns NIL instead of a value, I get a large stacktrace which goes down to SXQL:
I propose to check early for null values in find-dao (and friends) to get a smaller stacktrace like this one:
The value for the slot :ISNI should not be null (NIL)
[Condition of type SIMPLE-ERROR]
Restarts:
0: [RETRY] Retry SLIME REPL evaluation request.
1: [*ABORT] Return to SLIME's top level.
2: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {1005F41B63}>)
Backtrace:
0: (MITO.DAO::WHERE-AND (:ISNI NIL) #<MITO.DAO.TABLE:DAO-TABLE-CLASS FEL/MODELS::AUTHOR>)
1: (MITO.DAO:FIND-DAO #<MITO.DAO.TABLE:DAO-TABLE-CLASS FEL/MODELS::AUTHOR> :ISNI NIL)
2: (MAKE-CARD-FROM-DICT #<HASH-TABLE :TEST EQUAL :COUNT 31 {1002316D93}> :DB-SAVE NIL :FORCE T)
3: (SB-INT:SIMPLE-EVAL-IN-LEXENV (MAKE-CARD-FROM-DICT *CARD* :FORCE T) #<NULL-LEXENV>)
I got this by adding this check in the where-and function:
unless slot
do (error "Class ~S does not have a slot named ~S" class field)
unless value ;; <-- added
do (error "The value for the slot ~S should not be null (~S)" field value)
What do you think and how to check this in select-dao (it doesn't use where-and)?
Hi,
When I call
find-dao 'my-model :my-slot (get-data)
but(get-data)
is buggy and returns NIL instead of a value, I get a large stacktrace which goes down to SXQL:I propose to check early for null values in
find-dao
(and friends) to get a smaller stacktrace like this one:I got this by adding this check in the
where-and
function:What do you think and how to check this in
select-dao
(it doesn't use where-and)?Best,