diff --git a/pygeoapi/views.py b/pygeoapi/views.py index 2ed3c32..6cacb31 100644 --- a/pygeoapi/views.py +++ b/pygeoapi/views.py @@ -309,6 +309,14 @@ def get_feature(headers, args, dataset, identifier): LOGGER.debug('Fetching id {}'.format(identifier)) content = p.get(identifier) + if content is None: + exception = { + 'code': 'NotFound', + 'description': 'identifier not found' + } + LOGGER.error(exception) + return headers_, 404, json.dumps(exception) + content['links'] = [{ 'rel': 'self', 'type': 'application/json', @@ -320,14 +328,6 @@ def get_feature(headers, args, dataset, identifier): } ] - if content is None: - exception = { - 'code': 'NotFound', - 'description': 'identifier not found' - } - LOGGER.error(exception) - return headers_, 404, json.dumps(exception) - return headers_, 200, json.dumps(content)