From d928b0992072b63b40efbf32de9b7073190b7dad Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sun, 24 Sep 2023 04:25:22 +0200 Subject: [PATCH] Bookmaker: use actual Python exception for zoom error. --- bookmaker.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bookmaker.py b/bookmaker.py index f233d38..a82f986 100755 --- a/bookmaker.py +++ b/bookmaker.py @@ -81,7 +81,6 @@ parser.add_argument("-m", "--print_margin", type=float, default=0.43, help="prin parser.add_argument("-H", "--long_help", action="store_true", help="show examples, explanations, additional usage notes") args = parser.parse_args() - # select pages from input files def parse_page_range(range_string, pages): start_page = 0 @@ -166,8 +165,7 @@ if args.crops: zoom_horizontal = a4_width / (a4_width - crop_left - crop_right) zoom_vertical = a4_height / (a4_height - crop_bottom - crop_top) if (zoom_horizontal > 1 and zoom_vertical < 1) or (zoom_horizontal < 1 and zoom_vertical > 1): - print("Error: opposing zooms.") - exit(1) + raise ValueError("crops would create opposing zoom directions") elif zoom_horizontal + zoom_vertical > 2: zoom = min(zoom_horizontal, zoom_vertical) else: -- 2.30.2