+vats: fix crash on nonexistent desks

This commit is contained in:
Ted Blackman 2023-04-07 15:19:24 -04:00
parent af3ad860e7
commit cd161a5492

View File

@ -31,6 +31,18 @@
++ $ ++ $
|= [? ? ? ? ?] |= [? ? ? ? ?]
(report-vats:abed +<) (report-vats:abed +<)
::
++ kel-path
|= =desk
^- path
/[ego]/[desk]/[wen]/sys/kelvin
::
++ desk-exists
|= =desk
?& !=(ud.cass 0):.^(=cass %cw /[ego]/[desk]/[wen])
.^(? %cu (kel-path desk))
==
::
++ abed ++ abed
%= ..abed %= ..abed
cone .^(^cone %cx /[ego]//[wen]/domes) cone .^(^cone %cx /[ego]//[wen]/domes)
@ -47,7 +59,7 @@
|= desk=_`desk`%base |= desk=_`desk`%base
=/ pike (~(got by pikes) desk) =/ pike (~(got by pikes) desk)
=/ zest -:(~(got by rock) desk) =/ zest -:(~(got by rock) desk)
=/ kel-path /[ego]/[desk]/[wen]/sys/kelvin =/ kel-path (kel-path desk)
=/ sink=sink =/ sink=sink
?~ s=(~(get by sor) desk) ?~ s=(~(get by sor) desk)
~ ~
@ -62,8 +74,6 @@
desk=desk desk=desk
^= running =(%live zest) ^= running =(%live zest)
^= suspended =(%dead zest) ^= suspended =(%dead zest)
^= exists !=(ud.cass 0):.^(=cass %cw /[ego]/[desk]/[wen])
^= bad-desk ?!(.^(? %cu kel-path))
^= meb :: =(list @uv) ^= meb :: =(list @uv)
?~ sink [hash]~ ?~ sink [hash]~
(mergebase-hashes our desk now her.u.sink sud.u.sink) (mergebase-hashes our desk now her.u.sink sud.u.sink)
@ -90,6 +100,7 @@
!=(%live zest.pike) !=(%live zest.pike)
!(~(has in wic.pike) kel) !(~(has in wic.pike) kel)
== == == ==
::
++ report-vats ++ report-vats
|= $: verb=? |= $: verb=?
show-suspended=? show-suspended=?
@ -97,33 +108,33 @@
show-blocking=? show-blocking=?
show-nonexistent=? show-nonexistent=?
== ==
=/ [real=(list desk) fake=(list desk)]
(skid ~(tap in desks) desk-exists)
=; reals=tang
?. show-nonexistent
reals
%+ weld reals
`tang`(turn fake |=(=desk leaf+"nonexistent desk: {<desk>}"))
%+ turn %+ turn
%+ skim %+ skim (turn real vat-info)
%+ turn ~(tap in desks)
|= =desk (vat-info desk)
|= vat-info |= vat-info
:: just unconditionally show "bad" desks, whatever that means ?| &(suspended show-suspended)
?| bad-desk
&(suspended show-suspended)
&(running show-running) &(running show-running)
&(blocking show-blocking) &(blocking show-blocking)
&(!exists show-nonexistent)
== ==
|= =vat-info |= =vat-info
^- tank
:+ %rose [" " " " "::"] :+ %rose [" " " " "::"]
:- leaf+"{<desk.vat-info>}" :- leaf+"{<desk.vat-info>}"
%- flop %- flop
%- report-vat %- report-vat
[verb vat-info] [verb vat-info]
::
++ report-vat ++ report-vat
|= [verb=? vat-info] |= [verb=? vat-info]
^- tang ^- tang
?: !exists
~[leaf+"desk does not yet exist: {<desk>}"]
?: =(%kids desk) ?: =(%kids desk)
~[leaf+"%kids %cz hash: {<hash>}"] ~[leaf+"%kids %cz hash: {<hash>}"]
?: bad-desk
~[leaf+"bad desk: {<desk>}"]
%- flop %- flop
?. verb ?. verb
:~ leaf/"/sys/kelvin: {kul}" :~ leaf/"/sys/kelvin: {kul}"