I ran into this too. And I cheated. I modified wdhandler to give me a
chance to kill or handle the error. I also gave to option to open the
script containing the failing verb or whatever. Really handy when there is
no term window showing. Not pretty. But it would be good if something like
this could be made official.

5!:5<'wdhandler'

3 : 0

wdq=: wd 'q'

wd_val=. {:"1 wdq

({."1 wdq)=: wd_val

if. 3=4!:0<'wdhandler_debug' do.

try. wdhandler_debug'' catch. end.

end.

wd_ndx=. 1 i.~ 3 = 4!:0 [ 3 {. wd_val

if. 3 > wd_ndx do.

wd_fn=. > wd_ndx { wd_val

if. 13!:17'' do.

wd_fn~''

else.

try. wd_fn~''

catch.

wd_err=. 13!:12''

if. 0=4!:0 <'ERM_j_' do.

wd_erm=. ERM_j_

ERM_j_=: ''

if. wd_erm -: wd_err do. i.0 0 return. end.

end.

title=.'"Attention: Error in ',wd_fn,'" '

msg=.'"',wd_err,LF,'Select Open to open jfe for debugging, '

msg=.msg,'ignore to ignore the error or abort to end the app."'

select. wd 'mb query mb_open mb_ignore mb_abort ',title,msg

case. 'open' do. echo wd_err [ wd 'ide show'

case. 'abort' do.

if. 0=4!:0<'wdabort_j_' do. exit 4 end.

wdabort_j_=:'x'

if. (,' ')-:~.;(<0;1){wd 'sm get term'

do. exit 4

else. echo 'Abort ignored.'

end.

case. do.

end.

NB. wd_err=. LF,,LF,.(}.^:('|'e.~{.));._2 ,&LF^:(LF~:{:) wd_err

NB. echo wd_err

NB. wd 'ide show'

NB. wdinfo 'wdhandler';'error in: ',wd_fn,wd_err

end.

end.

end.

i.0 0

)


On Sat, Dec 21, 2019 at 11:29 AM Henry Rich <henryhr...@gmail.com> wrote:

> You can enclose the body of the verb in a try. block, and redefine the
> verb to ] in the catch. .
>
> Henry Rich
>
>
> On 12/21/2019 1:11 PM, Michal Wallace wrote:
> > Here's a little jqt program with a bug in it.
> >
> > When I accidentally run something like this, I get a modal dialog with an
> > error message.
> >
> > Closing the message box triggers the error again.
> >
> > Once that happens, the only way I know to recover is kill my whole J
> > session.
> >
> > Is there a better way? If not, could we maybe add a button to these
> > messages that would destroy the offending window?
> >
> > wd 'pc win0 closeok; pn "debug me"'
> > wd 'cc img isigraph'
> > wd 'pshow'
> > win0_img_paint =: verb define
> >    this is a bug
> > )
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to