check the exception to unexpected responses from the server.

This commit is contained in:
Yoshihiro OKUMURA 2024-09-18 11:22:03 +09:00
parent 24172dc65c
commit f2f898c263
Signed by: orrisroot
GPG Key ID: 470AA444C92904B2

View File

@ -1,5 +1,6 @@
import argparse import argparse
import sys import sys
from json import JSONDecodeError
from mdrsclient.commands import ( from mdrsclient.commands import (
ChaclCommand, ChaclCommand,
@ -52,6 +53,9 @@ def main() -> None:
except MDRSException as e: except MDRSException as e:
print(f"Error: {e}") print(f"Error: {e}")
sys.exit(2) sys.exit(2)
except JSONDecodeError:
print("Unexpected response returned. Please check the configuration or the server's operational status.")
sys.exit(2)
except KeyboardInterrupt: except KeyboardInterrupt:
sys.exit(130) sys.exit(130)