prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  [feaLib] "fonttools feaLib" should error out, not continue
  If there's a parse/build error when using the feaLib command line tool, we currently do this:
  
  https://github.com/fonttools/fonttools/blob/445108f735b22a5ca37f669808d47906d024fe24/Lib/fontTools/feaLib/__main__.py#L69-L73
  
  i.e. we save the font anyway and exit with status code 0.
  
  My Makefiles and I think this is a terrible idea, and I would like to change it. Any objections / thoughts?
  
  
  
  </issue>
  <code>
  [start of Lib/fontTools/feaLib/__main__.py]
  1 from fontTools.ttLib import TTFont
  2 from fontTools.feaLib.builder import addOpenTypeFeatures, Builder
  3 from fontTools.feaLib.error import FeatureLibError
  4 from fontTools import configLogger
  5 from fontTools.misc.cliTools import makeOutputFileName
  6 import sys
  7 import argparse
  8 import logging
  9 
  10 
  11 log = logging.getLogger("fontTools.feaLib")
  12 
  13 
  14 def main(args=None):
  15     """Add features from a feature file (.fea) into a OTF font"""
  16     parser = argparse.ArgumentParser(
  17         description="Use fontTools to compile OpenType feature files (*.fea)."
  18     )
  19     parser.add_argument(
  20         "input_fea", metavar="FEATURES", help="Path to the feature file"
  21     )
  22     parser.add_argument(
  23         "input_font", metavar="INPUT_FONT", help="Path to the input font"
  24     )
  25     parser.add_argument(
  26         "-o",
  27         "--output",
  28         dest="output_font",
  29         metavar="OUTPUT_FONT",
  30         help="Path to the output font.",
  31     )
  32     parser.add_argument(
  33         "-t",
  34         "--tables",
  35         metavar="TABLE_TAG",
  36         choices=Builder.supportedTables,
  37         nargs="+",
  38         help="Specify the table(s) to be built.",
  39     )
  40     parser.add_argument(
  41         "-d",
  42         "--debug",
  43         action="store_true",
  44         help="Add source-level debugging information to font.",
  45     )
  46     parser.add_argument(
  47         "-v",
  48         "--verbose",
  49         help="increase the logger verbosity. Multiple -v " "options are allowed.",
  50         action="count",
  51         default=0,
  52     )
  53     parser.add_argument(
  54         "--traceback", help="show traceback for exceptions.", action="store_true"
  55     )
  56     options = parser.parse_args(args)
  57 
  58     levels = ["WARNING", "INFO", "DEBUG"]
  59     configLogger(level=levels[min(len(levels) - 1, options.verbose)])
  60 
  61     output_font = options.output_font or makeOutputFileName(options.input_font)
  62     log.info("Compiling features to '%s'" % (output_font))
  63 
  64     font = TTFont(options.input_font)
  65     try:
  66         addOpenTypeFeatures(
  67             font, options.input_fea, tables=options.tables, debug=options.debug
  68         )
  69     except FeatureLibError as e:
  70         if options.traceback:
  71             raise
  72         log.error(e)
  73     font.save(output_font)
  74 
  75 
  76 if __name__ == "__main__":
  77     sys.exit(main())
  78
  [end of Lib/fontTools/feaLib/__main__.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/Lib/fontTools/feaLib/__main__.py b/Lib/fontTools/feaLib/__main__.py
  --- a/Lib/fontTools/feaLib/__main__.py
  +++ b/Lib/fontTools/feaLib/__main__.py
  @@ -70,6 +70,7 @@
           if options.traceback:
               raise
           log.error(e)
  +        sys.exit(1)
       font.save(output_font)
  
verification_info: {"golden_diff": "diff --git a/Lib/fontTools/feaLib/__main__.py b/Lib/fontTools/feaLib/__main__.py\n--- a/Lib/fontTools/feaLib/__main__.py\n+++ b/Lib/fontTools/feaLib/__main__.py\n@@ -70,6 +70,7 @@\n         if options.traceback:\n             raise\n         log.error(e)\n+        sys.exit(1)\n     font.save(output_font)\n", "issue": "[feaLib] \"fonttools feaLib\" should error out, not continue\nIf there's a parse/build error when using the feaLib command line tool, we currently do this:\r\n\r\nhttps://github.com/fonttools/fonttools/blob/445108f735b22a5ca37f669808d47906d024fe24/Lib/fontTools/feaLib/__main__.py#L69-L73\r\n\r\ni.e. we save the font anyway and exit with status code 0.\r\n\r\nMy Makefiles and I think this is a terrible idea, and I would like to change it. Any objections / thoughts?\r\n\r\n\n", "before_files": [{"content": "from fontTools.ttLib import TTFont\nfrom fontTools.feaLib.builder import addOpenTypeFeatures, Builder\nfrom fontTools.feaLib.error import FeatureLibError\nfrom fontTools import configLogger\nfrom fontTools.misc.cliTools import makeOutputFileName\nimport sys\nimport argparse\nimport logging\n\n\nlog = logging.getLogger(\"fontTools.feaLib\")\n\n\ndef main(args=None):\n    \"\"\"Add features from a feature file (.fea) into a OTF font\"\"\"\n    parser = argparse.ArgumentParser(\n        description=\"Use fontTools to compile OpenType feature files (*.fea).\"\n    )\n    parser.add_argument(\n        \"input_fea\", metavar=\"FEATURES\", help=\"Path to the feature file\"\n    )\n    parser.add_argument(\n        \"input_font\", metavar=\"INPUT_FONT\", help=\"Path to the input font\"\n    )\n    parser.add_argument(\n        \"-o\",\n        \"--output\",\n        dest=\"output_font\",\n        metavar=\"OUTPUT_FONT\",\n        help=\"Path to the output font.\",\n    )\n    parser.add_argument(\n        \"-t\",\n        \"--tables\",\n        metavar=\"TABLE_TAG\",\n        choices=Builder.supportedTables,\n        nargs=\"+\",\n        help=\"Specify the table(s) to be built.\",\n    )\n    parser.add_argument(\n        \"-d\",\n        \"--debug\",\n        action=\"store_true\",\n        help=\"Add source-level debugging information to font.\",\n    )\n    parser.add_argument(\n        \"-v\",\n        \"--verbose\",\n        help=\"increase the logger verbosity. Multiple -v \" \"options are allowed.\",\n        action=\"count\",\n        default=0,\n    )\n    parser.add_argument(\n        \"--traceback\", help=\"show traceback for exceptions.\", action=\"store_true\"\n    )\n    options = parser.parse_args(args)\n\n    levels = [\"WARNING\", \"INFO\", \"DEBUG\"]\n    configLogger(level=levels[min(len(levels) - 1, options.verbose)])\n\n    output_font = options.output_font or makeOutputFileName(options.input_font)\n    log.info(\"Compiling features to '%s'\" % (output_font))\n\n    font = TTFont(options.input_font)\n    try:\n        addOpenTypeFeatures(\n            font, options.input_fea, tables=options.tables, debug=options.debug\n        )\n    except FeatureLibError as e:\n        if options.traceback:\n            raise\n        log.error(e)\n    font.save(output_font)\n\n\nif __name__ == \"__main__\":\n    sys.exit(main())\n", "path": "Lib/fontTools/feaLib/__main__.py"}]}