My understanding is that an alias should have at most one :error, it doesn’t have to be right after the command that might cause the error, an error that happens anywhere in the alias will jump to the :error.
alias err {
if ($1 == 1) {
splay -q "sound.mp3"
}
elseif ($2 == 1) {
splay -q "sound.mp3"
}
goto end
:error
echo -s Error in alias err: $error
reseterror
:end
}
The reseterror might not be needed, simply having the :error in the alias might take care of it.