Fix exception name in phpdoc.
Fix detecting proper folder type.

Fixes sync breaking when attempting to move a non-email message
on certain clients (at least until we actually support doing this
in the various application APIs).