Skip to content

Commit

Permalink
Fixes #66. Don't hide exception
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Mar 7, 2018
1 parent cce2316 commit fdfd86f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
15 changes: 12 additions & 3 deletions ckanext/datapackager/logic/action/create.py
Expand Up @@ -2,6 +2,9 @@
import cgi
import json
import tempfile

import six

import ckan.plugins.toolkit as toolkit
from ckan_datapackage_tools import converter

Expand Down Expand Up @@ -65,10 +68,16 @@ def package_create_from_datapackage(context, data_dict):
if resources:
try:
_create_resources(dataset_id, context, resources)
res = toolkit.get_action('package_show')(context, {'id': dataset_id})
res = toolkit.get_action('package_show')(
context, {'id': dataset_id})
except Exception as e:
toolkit.get_action('package_delete')(context, {'id': dataset_id})
raise e
try:
toolkit.get_action('package_delete')(
context, {'id': dataset_id})
except Exception as e2:
six.raise_from(e, e2)
else:
raise e

res['state'] = 'active'
return toolkit.get_action('package_update')(context, res)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
@@ -1,3 +1,4 @@
python-slugify==1.2.4
datapackage==1.1.3
ckan-datapackage-tools==0.0.3b0
six

0 comments on commit fdfd86f

Please sign in to comment.