Throw PermissionException instead of IllegalStateException that was being used in older code.