-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from christoph-blessing/fix_issue59
Raise error when no entities are requested
- Loading branch information
Showing
4 changed files
with
43 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"""Contains preconditions that are applied to the handlers.""" | ||
from link.domain.commands import BatchCommand | ||
|
||
|
||
class NoEntitiesRequested(Exception): | ||
"""This exception is raised when a batch command that requests no entities is encountered.""" | ||
|
||
def __init__(self, command: BatchCommand) -> None: | ||
"""Initialize the exception.""" | ||
self.command = command | ||
|
||
|
||
def requests_entities(command: BatchCommand) -> None: | ||
"""Raise an exception if the given command requests no entities.""" | ||
if not command.requested: | ||
raise NoEntitiesRequested(command) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters