From 8d37fbc955d79ccb8f66f871769d721ba2eec8a1 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 2 Apr 2024 20:43:11 -0400 Subject: [PATCH] raise error instead of sys.exit (#569) `sys.exit` is a lousy implementation when one wants to catch the error. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dpdata/qe/scf.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dpdata/qe/scf.py b/dpdata/qe/scf.py index b8f9c129..cd9c6f28 100755 --- a/dpdata/qe/scf.py +++ b/dpdata/qe/scf.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 import os -import sys import numpy as np @@ -55,7 +54,7 @@ def get_cell(lines): raise RuntimeError("parameter 'a' or 'celldm(1)' cannot be found.") ret = np.array([[a, 0.0, 0.0], [0.0, a, 0.0], [0.0, 0.0, a]]) else: - sys.exit("ibrav > 1 not supported yet.") + raise RuntimeError("ibrav > 1 not supported yet.") return ret