-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
24 additions
and
21 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 |
---|---|---|
@@ -1,8 +1,6 @@ | ||
# This file is part of the QuestionPy Server. (https://questionpy.org) | ||
# The QuestionPy Server is free software released under terms of the MIT license. See LICENSE.md. | ||
# (c) Technische Universität Berlin, innoCampus <[email protected]> | ||
from abc import abstractmethod | ||
|
||
from aiohttp import web | ||
from aiohttp.log import web_logger | ||
|
||
|
@@ -27,9 +25,8 @@ def __init__(self, msg: str, body: RequestError | None = None) -> None: | |
web_logger.info(msg) | ||
|
||
|
||
|
||
class WorkerTimeoutError(web.HTTPBadRequest, _ExceptionMixin): | ||
def __init__(self, *, reason: str, temporary: bool) -> None: | ||
def __init__(self, *, reason: str | None, temporary: bool) -> None: | ||
super().__init__( | ||
msg="Question package did not answer in a reasonable amount of time", | ||
body=RequestError( | ||
|
@@ -41,7 +38,7 @@ def __init__(self, *, reason: str, temporary: bool) -> None: | |
|
||
|
||
class OutOfMemoryError(web.HTTPBadRequest, _ExceptionMixin): | ||
def __init__(self, *, reason: str, temporary: bool) -> None: | ||
def __init__(self, *, reason: str | None, temporary: bool) -> None: | ||
super().__init__( | ||
"Question package reached its memory limit", | ||
RequestError( | ||
|
@@ -53,7 +50,7 @@ def __init__(self, *, reason: str, temporary: bool) -> None: | |
|
||
|
||
class InvalidPackageError(web.HTTPBadRequest, _ExceptionMixin): | ||
def __init__(self, *, reason: str, temporary: bool) -> None: | ||
def __init__(self, *, reason: str | None, temporary: bool) -> None: | ||
super().__init__( | ||
"Invalid package was provided", | ||
RequestError( | ||
|
@@ -65,7 +62,7 @@ def __init__(self, *, reason: str, temporary: bool) -> None: | |
|
||
|
||
class InvalidRequestError(web.HTTPBadRequest, _ExceptionMixin): | ||
def __init__(self, *, reason: str, temporary: bool) -> None: | ||
def __init__(self, *, reason: str | None, temporary: bool) -> None: | ||
super().__init__( | ||
"Invalid request body was provided", | ||
RequestError( | ||
|
@@ -77,7 +74,7 @@ def __init__(self, *, reason: str, temporary: bool) -> None: | |
|
||
|
||
class PackageError(web.HTTPBadRequest, _ExceptionMixin): | ||
def __init__(self, *, reason: str, temporary: bool) -> None: | ||
def __init__(self, *, reason: str | None, temporary: bool) -> None: | ||
super().__init__( | ||
"An error occurred within the package", | ||
RequestError( | ||
|
@@ -89,7 +86,7 @@ def __init__(self, *, reason: str, temporary: bool) -> None: | |
|
||
|
||
class ServerError(web.HTTPInternalServerError, _ExceptionMixin): | ||
def __init__(self, *, reason: str, temporary: bool) -> None: | ||
def __init__(self, *, reason: str | None, temporary: bool) -> None: | ||
super().__init__( | ||
"There was an internal server error", | ||
RequestError( | ||
|
@@ -98,3 +95,8 @@ def __init__(self, *, reason: str, temporary: bool) -> None: | |
reason=reason, | ||
), | ||
) | ||
|
||
|
||
QpyWebError = ( | ||
WorkerTimeoutError | OutOfMemoryError | InvalidPackageError | InvalidRequestError | PackageError | ServerError | ||
) |
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
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