fix: handle error when merging 2 records fails
should give the user some idea of the problem instead of just sending error email to admins
This commit is contained in:
parent
067ca5bd43
commit
3b7cc19faa
|
@ -2292,9 +2292,13 @@ class MasterView(View):
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
self.request.session.flash("Requested merge cannot proceed (maybe swap kept/removed and try again?): {}".format(error), 'error')
|
self.request.session.flash("Requested merge cannot proceed (maybe swap kept/removed and try again?): {}".format(error), 'error')
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
self.merge_objects(object_to_remove, object_to_keep)
|
self.merge_objects(object_to_remove, object_to_keep)
|
||||||
self.request.session.flash("{} has been merged into {}".format(msg, object_to_keep))
|
self.request.session.flash("{} has been merged into {}".format(msg, object_to_keep))
|
||||||
return self.redirect(self.get_action_url('view', object_to_keep))
|
return self.redirect(self.get_action_url('view', object_to_keep))
|
||||||
|
except Exception as error:
|
||||||
|
error = simple_error(error)
|
||||||
|
self.request.session.flash(f"merge failed: {error}", 'error')
|
||||||
|
|
||||||
if not object_to_remove or not object_to_keep or object_to_remove is object_to_keep:
|
if not object_to_remove or not object_to_keep or object_to_remove is object_to_keep:
|
||||||
return self.redirect(self.get_index_url())
|
return self.redirect(self.get_index_url())
|
||||||
|
|
Loading…
Reference in a new issue