这是一个用球拍脚本制作的雷达解析器,通过tcp连接到DCS世界(飞行模拟器视频游戏)如何对此代码实施错误检查?错误处理程序的过程将检查什么以及过程应该作为语句输出什么?
(define/public (parse)
; needs error checking
(if (and (equal? jsexpr (json-null)) (not (equal? jsonstr "")))
(set! jsexpr (string->jsexpr jsonstr) )
null)
(set! azimuth (hash-ref jsexpr 'Azimuth) )
(set! id (hash-ref jsexpr 'ID) )
(set! power (hash-ref jsexpr 'Power) )
(set! priority (hash-ref jsexpr 'Priority) )
(set! signaltype (hash-ref jsexpr 'SignalType) )
(set! radartype (hash-ref jsexpr 'Type) )
(if (member 'TypeInts (hash-keys jsexpr))
(set! typeints (hash-ref jsexpr 'TypeInts))
null)
(set! airborne (airborne-type radartype typeints) )
;(set! highpriority (high-priority this typeints))
(set! awacs (if (and
(= (car typeints) 1)
(= (cadr typeints) 1)
(= (caddr typeints) 5)
) #t #f))
(set! tracking (if
( and (equal? signaltype "lock") (equal? (modulo i 5) 0))
#t
#f
)
)