Skip to content
Snippets Groups Projects
Commit 1170a17b authored by Sid Verma's avatar Sid Verma
Browse files

BlockLimitReachedError should returns a 400 response instead of 500

parent 2578877d
No related merge requests found
......@@ -454,8 +454,6 @@ class ContentLibrariesTest(ContentLibrariesRestApiTest):
lib_id = lib["id"]
block_data = self._add_block_to_library(lib_id, "unit", "unit1")
# Second block should throw error
with self.assertRaises(BlockLimitReachedError):
self._add_block_to_library(lib_id, "problem", "problem1")
self._add_block_to_library(lib_id, "problem", "problem1", expect_response=400)
# Also check that limit applies to child blocks too
with self.assertRaises(BlockLimitReachedError):
self._add_block_to_library(lib_id, "html", "html1", parent_block=block_data["id"])
self._add_block_to_library(lib_id, "html", "html1", parent_block=block_data['id'], expect_response=400)
......@@ -58,6 +58,9 @@ def convert_exceptions(fn):
except api.InvalidNameError as exc:
log.exception(str(exc))
raise ValidationError(str(exc))
except api.BlockLimitReachedError as exc:
log.exception(str(exc))
raise ValidationError(str(exc))
return wrapped_fn
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment