Changeset - b38ffa9fbcfc
[Not reviewed]
version_5
0 1 0
Dennis Fink - 10 years ago 2015-08-30 15:22:54
dennis.fink@c3l.lu
Use try except for updating weights
1 file changed with 6 insertions and 1 deletions:
0 comments (0 inline, 0 general)
ennstatus/api/views.py
Show inline comments
 
@@ -88,14 +88,19 @@ def update():
 
    try:
 
        server = Server.from_dict(data)
 
    except Exception as e:
 
        current_app.logger.warning(' '.join([str(e), str(data)]))
 
        return str(e), 409, {'Content-Type': 'text/plain'}
 

	
 
    if server.type in ('exit', 'relay'):
 
    try:
 
        server.update_weights()
 
    except NotImplementedError:
 
        pass
 
    except requests.HTTPError as e:
 
        current_app.logger.error(str(e), exc_info=True)
 
        pass
 

	
 
    try:
 
        server.save()
 
    except Exception as e:
 
        current_app.logger.error(str(e))
 
        return str(e), 500, {'Content-Type': 'text/plain'}
0 comments (0 inline, 0 general)