RBAC.
Tidy up error handling for generatePreviewPdf.