diff --git a/xmlsitemap.module b/xmlsitemap.module
index 6f031be..c918aec 100644
--- a/xmlsitemap.module
+++ b/xmlsitemap.module
@@ -13,6 +13,7 @@ use Drupal\Component\Utility\Crypt;
 use Drupal\Component\Utility\SafeMarkup;
 use Drupal\Component\Utility\Unicode;
 use Drupal\Component\Utility\UrlHelper;
+use Drupal\Core\Database\DatabaseException;
 use Drupal\Core\Render\Element;
 use Drupal\Core\Entity\EntityForm;
 use Drupal\Core\Entity\EntityInterface;
@@ -1579,7 +1580,12 @@ function xmlsitemap_xmlsitemap_process_entity_links($entity_type, array $ids) {
   foreach ($entities as $entity) {
     $link_storage = \Drupal::service('xmlsitemap.link_storage');
     $link = $link_storage->create($entity);
-    $link_storage->save($link);
+    try {
+      $link_storage->save($link);
+    }
+    catch (DatabaseException $e) {
+      watchdog_exception('xmlsitemap', $e);
+    }
   }
 }
 
@@ -1602,7 +1608,12 @@ function xmlsitemap_entity_presave(EntityInterface $entity) {
   if (!empty($id)) {
     $link_storage = \Drupal::service('xmlsitemap.link_storage');
     $link = $link_storage->create($entity);
-    $link_storage->save($link);
+    try {
+      $link_storage->save($link);
+    }
+    catch (DatabaseException $e) {
+      watchdog_exception('xmlsitemap', $e);
+    }
   }
 }
 
@@ -1623,7 +1634,12 @@ function xmlsitemap_entity_insert(EntityInterface $entity) {
 
   $link_storage = \Drupal::service('xmlsitemap.link_storage');
   $link = $link_storage->create($entity);
-  $link_storage->save($link);
+  try {
+    $link_storage->save($link);
+  }
+  catch (DatabaseException $e) {
+    watchdog_exception('xmlsitemap', $e);
+  }
 }
 
 /**
@@ -1643,7 +1659,12 @@ function xmlsitemap_entity_update(EntityInterface $entity) {
 
   $link_storage = \Drupal::service('xmlsitemap.link_storage');
   $link = $link_storage->create($entity);
-  $link_storage->save($link);
+  try {
+    $link_storage->save($link);
+  }
+  catch (DatabaseException $e) {
+    watchdog_exception('xmlsitemap', $e);
+  }
 }
 
 /**
