Skip to content
Snippets Groups Projects
Unverified Commit 1c60d547 authored by Braden MacDonald's avatar Braden MacDonald Committed by GitHub
Browse files

Merge PR #24803: [BD-14] BlockLimitReachedError should returns a 400 response instead of 500

https://github.com/edx/edx-platform/pull/24803
parents 961b71f1 1170a17b
No related branches found
No related tags found
No related merge requests found
......@@ -500,8 +500,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)
......@@ -60,6 +60,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