There's no direct way to exit a loop if an error occurs. The obvious way is to use a while loop instead of a for loop, but that doesn't combine easily with iterating over a list. You'd need to assemble the list into a variable and then explicitly remove the elements from the list, which makes the code a lot more complex.
items=(cache thumbs);
while ((${#items[@]})) && my template "${items[0]}":clear; do shift items; done
((${#items[@]} == 0)) # to check if all the items were processed
A shorter way to write this than using an if statement is
for what in cache thumbs; do
my template "$what":clear || break;
done
Using boolean operators is usually less readable than using if, but somecommand || fallback is fairly idiomatic.
Note that the for loop always succeeds. There's no convenient way to know whether the code exited early (you can test whether $what is the last item after the loop, but that requires having a convenient way to know what the last item was and it doesn't let you know whether the last item was processed successfully).
This doesn't scale well to multiple commands. You can instead turn on errexit mode with set -e. This causes the shell to exit as soon as a command fails (in simple cases — the details are rather complex, but it's enough here). Note that the whole (sub)shell exits, not just the containing loop or the containing function or the containing script. To exit just a part of the script, put that part in a subshell. Note that variable modifications don't survive the subshell.
( set -e;
for what in cache thumbs; do
my template "$what":clear;
done
)
# Here $? is 0 if all the mv commands succeeded and nonzero otherwise