Whole file
heuer/segno
The author described this change as “CLI raises no exception with a traceback anymore but writes the error msg to std.error and returns an error code.”. It counts as a record because the check below fails on the code as it stood at 79307d856 and passes on 01bd15d31, with nothing else changed between the two runs.
Projectheuer/segno
Fix saved2018-03-18
Sharing licenceBSD-3-Clause · LICENSE
Change size+7 −1
What the code was meant to do, written into the code itself as a save note
CLI raises no exception with a traceback anymore but writes the error msg to std.error and returns an error code.
The change
| 12 | 12 | "QR Code" and "Micro QR Code" are registered trademarks of DENSO WAVE INCORPORATED. | |
| 13 | 13 | """ | |
| 14 | 14 | from __future__ import absolute_import, unicode_literals | |
| 15 | + | import os | |
| 15 | 16 | import sys | |
| 16 | 17 | import argparse | |
| 17 | 18 | import segno | |
| ⋯ | |||
| 192 | 193 | ||
| 193 | 194 | def main(args=sys.argv[1:]): | |
| 194 | 195 | config = parse(args) | |
| 195 | - | qr = make_code(config) | |
| 196 | + | try: | |
| 197 | + | qr = make_code(config) | |
| 198 | + | except segno.QRCodeError as ex: | |
| 199 | + | sys.stderr.writelines([str(ex), os.linesep]) | |
| 200 | + | return sys.exit(1) | |
| 196 | 201 | output = config.pop('output') | |
| 197 | 202 | if output is None: | |
| 198 | 203 | qr.terminal(border=config['border']) | |
| 199 | 204 | else: | |
| 200 | 205 | qr.save(output, **build_config(config, filename=output)) | |
| 206 | + | return 0 | |
| 201 | 207 | ||
| 202 | 208 | ||
| 203 | 209 | class _AttrDict(dict): | |
The check that tells the two apart
fail→pass·tests/test_cli.py::test_error_code
Check file tests/test_cli.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it79307d85681bcccff1102cd2f3a1ae1b2364b29d
Broken version dated2018-02-25
Modulesegno.cli
Units changedmain
Fingerprintecaf07999dd091de
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in heuer/segno
- 2020-07-30make_segment
- 2020-01-02make_vcard_data
- 2019-12-21make_vcard_data