From 482e199626374210582390baf842cde7c2536a65 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 11 Nov 2021 18:17:04 -0800 Subject: [PATCH] Only show up to 5 examples in errors While testing #6 I realized that a CSV file with 150,000+ lines results in incredibly long error messages --- git_history/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git_history/cli.py b/git_history/cli.py index bd2adee..3e1e529 100644 --- a/git_history/cli.py +++ b/git_history/cli.py @@ -157,7 +157,7 @@ def file( if bad_items: raise click.ClickException( "Commit: {} - every item must have the --id keys. These items did not:\n{}".format( - git_hash, json.dumps(bad_items, indent=4, default=str) + git_hash, json.dumps(bad_items[:5], indent=4, default=str) ) ) # Also ensure there are not TWO items in this file with the same ID @@ -181,7 +181,7 @@ def file( dict((id, item.get(id)) for id in fixed_ids) ) == item_id - ], + ][:5], indent=4, default=str, ),