Join Elevate
Curtis Call wrote an excellent article on that very topic: SLAX: Error Detection . This article is well worth your time if you’re creating any SLAX-based Junos automation