// @todo Convert the custom export functionality to serializer.
if (!method_exists($this->bookExport, $method)) {
- drupal_set_message(t('Unknown export format.'));
+ $this->messenger()->addStatus(t('Unknown export format.'));
throw new NotFoundHttpException();
}