Skip to content

Commit

Permalink
Merge pull request #300 from cpennington/add-valid-scope
Browse files Browse the repository at this point in the history
Allow recording of allowed scopes in InvalidScopeError
  • Loading branch information
cpennington committed May 22, 2015
2 parents 1934a29 + e9c4d44 commit e1831fa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion xblock/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ class InvalidScopeError(Exception):
"""
Raised to indicated that operating on the supplied scope isn't allowed by a KeyValueStore
"""
pass
def __init__(self, invalid_scope, valid_scopes=None):
if valid_scopes:
super(InvalidScopeError, self).__init__("Invalid scope: {}. Valid scopes are: {}".format(
invalid_scope,
valid_scopes,
))
else:
super(InvalidScopeError, self).__init__("Invalid scope: {}".format(invalid_scope))


class NoSuchViewError(Exception):
Expand Down

0 comments on commit e1831fa

Please sign in to comment.