Skip to content

Commit 4b1ba1f

Browse files
author
Matthew Fisher
committed
feat(controller): more info with bad scale operation
1 parent 3c35dce commit 4b1ba1f

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

controller/api/tests/test_container.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,8 @@ def test_container_errors(self):
307307
response = self.client.post(url, json.dumps(body), content_type='application/json',
308308
HTTP_AUTHORIZATION='token {}'.format(self.token))
309309
self.assertEqual(response.status_code, 400)
310-
self.assertEqual(response.data, {'detail': 'Invalid scaling format'})
310+
self.assertEqual(response.data, {'detail': "Invalid scaling format: invalid literal for "
311+
"int() with base 10: 'not_an_int'"})
311312
body = {'invalid': 1}
312313
response = self.client.post(url, json.dumps(body), content_type='application/json',
313314
HTTP_AUTHORIZATION='token {}'.format(self.token))

controller/api/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ def scale(self, request, **kwargs):
139139
new_structure[target] = int(count)
140140
models.validate_app_structure(new_structure)
141141
app.scale(request.user, new_structure)
142-
except (TypeError, ValueError):
143-
return Response({'detail': 'Invalid scaling format'},
142+
except (TypeError, ValueError) as e:
143+
return Response({'detail': 'Invalid scaling format: {}'.format(e)},
144144
status=status.HTTP_400_BAD_REQUEST)
145145
except (EnvironmentError, ValidationError) as e:
146146
return Response({'detail': str(e)}, status=status.HTTP_400_BAD_REQUEST)

0 commit comments

Comments
 (0)