Changed some error messages
This commit is contained in:
@@ -244,6 +244,9 @@ class PingAction(AlpineBitsAction):
|
||||
async def handle(self, action: str, request_xml: str, version: Version, server_capabilities: None | ServerCapabilities = None) -> AlpineBitsResponse:
|
||||
"""Handle ping requests."""
|
||||
|
||||
if request_xml is None:
|
||||
return AlpineBitsResponse(f"Error: Xml Request missing", HttpStatusCode.BAD_REQUEST)
|
||||
|
||||
if server_capabilities is None:
|
||||
return AlpineBitsResponse("Error: Something went wrong", HttpStatusCode.INTERNAL_SERVER_ERROR)
|
||||
|
||||
@@ -253,9 +256,10 @@ class PingAction(AlpineBitsAction):
|
||||
|
||||
try:
|
||||
parsed_request = parser.from_string(request_xml, OtaPingRq)
|
||||
|
||||
echo_data = json.loads(parsed_request.echo_data)
|
||||
except Exception as e:
|
||||
return AlpineBitsResponse(f"Error: Invalid XML request - {str(e)}", HttpStatusCode.BAD_REQUEST)
|
||||
return AlpineBitsResponse(f"Error: Invalid XML request", HttpStatusCode.BAD_REQUEST)
|
||||
|
||||
# compare echo data with capabilities, create a dictionary containing the matching capabilities
|
||||
capabilities_dict = server_capabilities.get_capabilities_dict()
|
||||
|
||||
Reference in New Issue
Block a user