The right way is to check the exit status of each command and do whatever cleanup is appropriate at that point. (Along with printing an appropriate error message, but the tools themselves likely do that already.) For example, if the directoryfile gets created, but the filepermissions can't be created within itset properly, do you want to leave the presumably useless empty directoryfile there, or should you (try to) remove it? Similarly if the file gets created, but the permissions can't be set properly, do you want to leave the file and the directory there?
(Granted, this particular case would be a bit unexpected, but anyway.)
If you don't care about that, and are happy to leave the userwant to clean up the messbe that fancy, then just say you want to run each command only if the previous one succeeds, i.e. join them with &&:
file=foo
if cd test &&
touch "$file" &&
chown root:root "$file"
then
echo ok.
else
echo something failed.
fi
Note that that would leave the script running in the newly-created directory. Which may or may not be what you want to do, depending on what the script does next. Of course you could still use a subshell to isolate the effects of the cd:
if ( cd test &&
touch "$file" &&
chown root:root "$file" )
then ...
or just do away with the cd entirely:
filepath="test/$file"
if touch "$filepath" &&
chown root:root "$filepath" )
then ...
(don't use path as a variable name if you think you'll ever use zsh; it'll blow up hilariously.)
In any case, forget about set -e. It doesn't do what you want and is confusing enough to likely be worse than useless. See e.g. BashFAQ 105