Please note that the ON ERROR event, like the ON TEXT event, cannot be triggered by the client that the code is on.
In your case place on your bot:
on ^*:error:*:{
.msg <your nick> $1-
haltdef
}
Replace <your nick> with yuor actual nick, using $me will return the bot's nick, not yours.