Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
1170a17b
Commit
1170a17b
authored
4 years ago
by
Sid Verma
Browse files
Options
Downloads
Patches
Plain Diff
BlockLimitReachedError should returns a 400 response instead of 500
parent
2578877d
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
openedx/core/djangoapps/content_libraries/tests/test_content_libraries.py
+2
-4
2 additions, 4 deletions
...ngoapps/content_libraries/tests/test_content_libraries.py
openedx/core/djangoapps/content_libraries/views.py
+3
-0
3 additions, 0 deletions
openedx/core/djangoapps/content_libraries/views.py
with
5 additions
and
4 deletions
openedx/core/djangoapps/content_libraries/tests/test_content_libraries.py
+
2
−
4
View file @
1170a17b
...
...
@@ -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
)
This diff is collapsed.
Click to expand it.
openedx/core/djangoapps/content_libraries/views.py
+
3
−
0
View file @
1170a17b
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment