Ein Chain(E) liefert nicht %error() sondern %found(), das (E) kannst du auch weglassen, also :

if not %found();
leave;
endif;