From: Christian Heller Date: Sun, 24 Sep 2023 02:25:22 +0000 (+0200) Subject: Bookmaker: use actual Python exception for zoom error. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/%7B%7Bprefix%7D%7D/test?a=commitdiff_plain;h=d928b0992072b63b40efbf32de9b7073190b7dad;p=misc Bookmaker: use actual Python exception for zoom error. --- 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: