def run_command(request, command):
    
    # check we have a valid command, if not throw a 404
    existing_command = get_object_or_404(Command, slug__iexact=command)

    # check whether we're using the message queue or not
    if settings.QUEUE_COMMANDS:
        run = existing_command.queue_run()
    else:
        run = existing_command.run()
    
    # redirect to the run that's been created
    return HttpResponseRedirect(run.get_absolute_url())
send_async should capture sending exceptions properly.
dataset/ETHPy150Open garethr/Asteroid/asteroid/apps/runner/views.py/run_command--crossover with--dataset/ETHPy150Open rapidsms/rapidsms/rapidsms/router/celery/tests.py/CeleryRouterTest.test_send_async_catches_error