I think the following will do it:
<!-- start of script with usual headers, etc -->
<core:catch var="err">
<!-- do stuff -->
</core:catch>
<core:if test="${not empty(err)}">
<!-- do stuff because an error was trapped -->
</core:if>
<!-- finally -->
<!-- the code will always run to here whether an error was trapped or not -->
<!-- do end-of-code clean-up stuff -->
<!-- end of script -->
Obviously, there's a lot more detail you will have to add.