home · contact · privacy
Bookmaker: use actual Python exception for zoom error.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 24 Sep 2023 02:25:22 +0000 (04:25 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 24 Sep 2023 02:25:22 +0000 (04:25 +0200)
bookmaker.py

index f233d384e921d970fe40d7daa65eea670561ce2a..a82f9861862ae827226fe0ca816dd36f86fbd5e7 100755 (executable)
@@ -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: