Skip to content

Commit

Permalink
Catch non-existent trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
mhemeryck authored and Martijn Hemeryck committed May 23, 2018
1 parent e5f59c6 commit 006f60b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion djtriggers/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

from django.apps import apps

from .models import Trigger


logger = get_task_logger(__name__)

Expand All @@ -21,4 +23,7 @@ def clean_triggers():

@shared_task
def process_trigger(trigger_id, trigger_app_label, trigger_class, *args, **kwargs):
apps.get_model(trigger_app_label, trigger_class).objects.get(id=trigger_id).process(*args, **kwargs)
try:
apps.get_model(trigger_app_label, trigger_class).objects.get(id=trigger_id).process(*args, **kwargs)
except Trigger.DoesNotExist:
pass

0 comments on commit 006f60b

Please sign in to comment.