Skip to content

Commit 53e1ed1

Browse files
authored
Handle errors when creating changesets (#687)
1 parent 2540775 commit 53e1ed1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

osmchadjango/changeset/tasks.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from yaml import Loader
1111

1212
from django.conf import settings
13+
from django.db.utils import IntegrityError
1314

1415
import requests
1516
from requests_oauthlib import OAuth1Session
@@ -52,7 +53,11 @@ def get_filter_changeset_file(url, geojson_filter=settings.CHANGESETS_FILTER):
5253
cl = ChangesetList(url, geojson_filter)
5354
for c in cl.changesets:
5455
print("Creating changeset {}".format(c["id"]))
55-
create_changeset(c["id"])
56+
try:
57+
create_changeset(c["id"])
58+
except IntegrityError as e:
59+
print("IntegrityError when importing {}.".format(c["id"]))
60+
print(e)
5661

5762

5863
def format_url(n):

0 commit comments

Comments
 (0)