Skip to content
Snippets Groups Projects
Commit 417be932 authored by Felip Manyer i Ballester's avatar Felip Manyer i Ballester
Browse files

Exception handling in entity controller

parent d007e48f
Branches 7.x-1.x
Tags 7.x-1.0-alpha2
No related merge requests found
<?php
use ResTelae\Gbif\GbifException;
use ResTelae\Gbif\Occurrences;
/**
......@@ -20,7 +21,18 @@ class GbifOccurrenceController extends EntityAPIController {
}
else {
$occ = new Occurrences();
if ($values = $occ->get($id)) {
try {
$values = $occ->get($id);
}
catch (GbifException $e) {
watchdog('gbif2', 'Unable to get GBIF occurrence #%id. Message returned: %msg', [
'%id' => $id,
'%msg' => $e->getMessage(),
],
WATCHDOG_ERROR);
continue;
}
if ($values) {
$entity = entity_create('gbif_occurrence', $values);
cache_set($cid, $entity, 'cache', CACHE_TEMPORARY);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment