You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If an intervention definition is not found – for example because the interventions have not been installed – any attempt to run the simulator results in an error server side, but no error is apparently reported back to the client. I'd expect a 500 error of some sort.
$ pserve development.ini
Starting server in PID 84091.
serving on http://0.0.0.0:6543
2015-11-02 21:20:07,060 ERROR [pyramid_debugtoolbar][waitress] Exception at http://0.0.0.0:6543/simulate
traceback url: http://0.0.0.0:6543/_debug_toolbar/exception?token=62275c7866355c783032795c7865325f4e2e5c786566325c78666127&tb=4428651208
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/Users/rjs/dev/bark-spider/bark_spider/intervention.py", line 40, in _parse_intervention
cls = _interventions()[command]
KeyError: 'add'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/Users/rjs/dev/bark-spider/bark_spider/simulation/simulation.py", line 27, in run_simulation
schedule = make_schedule(**params)
File "/Users/rjs/dev/bark-spider/bark_spider/simulation/schedule.py", line 74, in make_schedule
parse_interventions(StringIO(interventions)))
File "/Users/rjs/dev/bark-spider/bark_spider/simulation/schedule.py", line 14, in __init__
self._interventions = sorted(interventions, key=lambda i: i.time)
File "/Users/rjs/dev/bark-spider/bark_spider/intervention.py", line 45, in _parse_intervention
command, line))
ValueError: Unknown command "add" while parsing interventions. (full command=add 100 10)
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/rjs/dev/virtualenvs/bark-spider/lib/python3.4/site-packages/pyramid_debugtoolbar/toolbar.py", line 192, in toolbar_tween
response = _handler(request)
File "/Users/rjs/dev/virtualenvs/bark-spider/lib/python3.4/site-packages/pyramid_debugtoolbar/panels/performance.py", line 57, in resource_timer_handler
result = handler(request)
File "/Users/rjs/dev/virtualenvs/bark-spider/lib/python3.4/site-packages/pyramid/tweens.py", line 21, in excview_tween
response = handler(request)
File "/Users/rjs/dev/virtualenvs/bark-spider/lib/python3.4/site-packages/pyramid/router.py", line 163, in handle_request
response = view_callable(context, request)
File "/Users/rjs/dev/virtualenvs/bark-spider/lib/python3.4/site-packages/pyramid/config/views.py", line 329, in attr_view
return view(context, request)
File "/Users/rjs/dev/virtualenvs/bark-spider/lib/python3.4/site-packages/pyramid/config/views.py", line 305, in predicate_wrapper
return view(context, request)
File "/Users/rjs/dev/virtualenvs/bark-spider/lib/python3.4/site-packages/pyramid/config/views.py", line 355, in rendered_view
result = view(context, request)
File "/Users/rjs/dev/virtualenvs/bark-spider/lib/python3.4/site-packages/pyramid/config/views.py", line 501, in _requestonly_view
response = view(request)
File "/Users/rjs/dev/bark-spider/bark_spider/views.py", line 42, in simulate_route
lambda: _async_simulation(sim_params))
File "/Users/rjs/dev/bark-spider/bark_spider/simulation_db.py", line 15, in add_results
results = gen()
File "/Users/rjs/dev/bark-spider/bark_spider/views.py", line 42, in <lambda>
lambda: _async_simulation(sim_params))
File "/Users/rjs/dev/bark-spider/bark_spider/views.py", line 24, in _async_simulation
return result.get(timeout)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/multiprocessing/pool.py", line 599, in get
raise self._value
ValueError: Unknown command "add" while parsing interventions. (full command=add 100 10)
The text was updated successfully, but these errors were encountered:
The parsing-errors branch addresses this issue. I've decided to return HTTP/400 when there is a problem parsing interventions. Since I don't think we can distinguish between a mistyped intervention and one which is not installed, there's no condition under which I felt a 500 was correct.
If an intervention definition is not found – for example because the interventions have not been installed – any attempt to run the simulator results in an error server side, but no error is apparently reported back to the client. I'd expect a 500 error of some sort.
The text was updated successfully, but these errors were encountered: