Skip to content

Commit

Permalink
Prevent print traceback on ZKSDK error
Browse files Browse the repository at this point in the history
  • Loading branch information
bdragon300 committed Nov 3, 2024
1 parent a8b90d3 commit 741ef4b
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pyzkaccess/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,19 @@
import wrapt
from fire.core import FireError

from pyzkaccess import ZK100, ZK200, ZK400, AuxInput, Door, Reader, Relay, UnsupportedPlatformError, ZKAccess, ZKModel
from pyzkaccess import (
ZK100,
ZK200,
ZK400,
AuxInput,
Door,
Reader,
Relay,
UnsupportedPlatformError,
ZKAccess,
ZKModel,
ZKSDKError,
)
from pyzkaccess._setup import setup
from pyzkaccess.device_data.model import Model, models_registry
from pyzkaccess.device_data.queryset import QuerySet
Expand Down Expand Up @@ -1255,7 +1267,8 @@ def main():
sys.stderr.write(f"ERROR: Platform {sys.platform} is not supported\n")
sys.exit(5)
except Exception as e:
sys.stderr.write(traceback.format_exc())
if not isinstance(e, ZKSDKError):
sys.stderr.write(traceback.format_exc())
sys.stderr.write(
f"ERROR: {e}\n"
f"Please ensure that the environment is set up correctly by running the `pyzkaccess setup` command\n"
Expand Down

0 comments on commit 741ef4b

Please sign in to comment.