diff --git a/islandora_herbarium_object.info.yml b/islandora_herbarium_object.info.yml index 4126f24..b4b65a7 100644 --- a/islandora_herbarium_object.info.yml +++ b/islandora_herbarium_object.info.yml @@ -2,6 +2,7 @@ name: 'Islandora Herbarium Object' description: 'Provides Islandora Herbarium Object content type and related configuration. Islandora Herbarium Object' type: module core: 8.x +core_version_requirement: ^8 || ^9 dependencies: - datetime - field diff --git a/islandora_herbarium_object.module b/islandora_herbarium_object.module index 8454c8e..68b53b0 100644 --- a/islandora_herbarium_object.module +++ b/islandora_herbarium_object.module @@ -57,8 +57,8 @@ function islandora_herbarium_object_entity_presave(EntityInterface $entity) { $geo->updateEntity($entity); } catch (Exception $e) { - drupal_set_message(t('There was an error retrieving Geo data. %msg.', - ['%msg' => $e->getMessage()]), 'error'); + \Drupal::messenger()->addError(t('There was an error retrieving Geo data. %msg.', + ['%msg' => $e->getMessage()])); } // Get the taxonomy data. try { @@ -66,8 +66,8 @@ function islandora_herbarium_object_entity_presave(EntityInterface $entity) { $taxon->updateEntity($entity); } catch (Exception $e) { - drupal_set_message(t('There was an error retrieving Taxon data. %msg.', - ['%msg' => $e->getMessage()]), 'error'); + \Drupal::messenger()->addError(t('There was an error retrieving Taxon data. %msg.', + ['%msg' => $e->getMessage()])); } $title = $taxon->getValue('canonicalName') . ' - ' . $geo->getValue('name'); if ($title != ' - ') { diff --git a/src/DataParser/GbifParser.php b/src/DataParser/GbifParser.php index ac973b4..d947381 100644 --- a/src/DataParser/GbifParser.php +++ b/src/DataParser/GbifParser.php @@ -47,12 +47,7 @@ class GbifParser extends DataParser { } catch (Exception $e) { watchdog_exception('islandora_herbarium_object', $e, 'Error getting dwciri'); - drupal_set_message(t('There was an error retrieving Taxon data. %msg. Verify the url is correct %url', - [ - '%msg' => $e->getMessage(), - '%url' => $taxoniri[0]['value'], - ]), 'error'); - return; + throw ($e); } $entity->set('field_dwc_scientificname', $this->getValue('canonicalName')); $name_arr = explode(' ', $this->getValue('canonicalName')); diff --git a/src/DataParser/NrcanParser.php b/src/DataParser/NrcanParser.php index 56c7c40..2aad9b6 100644 --- a/src/DataParser/NrcanParser.php +++ b/src/DataParser/NrcanParser.php @@ -50,9 +50,7 @@ class NrcanParser extends DataParser { } catch (Exception $e) { watchdog_exception('islandora_herbarium_object', $e, 'Error getting dwciri'); - drupal_set_message(t('There was an error retrieving Municipality data. %msg. Verify the url is correct %url', - ['%msg' => $e->getMessage(), '%url' => $dwciri[0]['value']]), 'error'); - return; + throw ($e); } $entity->set('field_dwc_municipality', $this->getValue('name')); // This parser assumes we are in canada. @@ -68,8 +66,7 @@ class NrcanParser extends DataParser { $province = $p_arr['description']; } catch (Exception $e) { - drupal_set_message(t('There was an error retrieving Province data. %msg.', - ['%msg' => $e->getMessage()]), 'error'); + watchdog_exception('islandora_herbarium_object', $e, 'There was an error retrieving Province data'); } $entity->set('field_dwc_stateprovince', $province); $point = [