diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-01-31 21:37:12 -0500 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-01-31 21:37:12 -0500 |
commit | 0e78e07f8e525821705133dc7db5ee8c206223db (patch) | |
tree | 459153ced93b04bbba242cd20f63663bad3ece47 | |
parent | ba60ee65e942ef99a7296a924cea1a710da485e9 (diff) | |
download | korg-helpers-0e78e07f8e525821705133dc7db5ee8c206223db.tar.gz |
Return a useful error for unknown msgids
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rwxr-xr-x | get-lore-mbox.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/get-lore-mbox.py b/get-lore-mbox.py index 84614c0..45f771c 100755 --- a/get-lore-mbox.py +++ b/get-lore-mbox.py @@ -95,6 +95,9 @@ def get_pi_thread_by_msgid(msgid, config, outdir='.'): midmask = config['midmask'] % msgid logger.info('Looking up %s', midmask) resp = requests.head(midmask) + if resp.status_code < 300 or resp.status_code > 400: + logger.critical('That message-id is not known.') + return None canonical = resp.headers['Location'].rstrip('/') resp.close() t_mbx_url = '%s/t.mbox.gz' % canonical @@ -299,7 +302,7 @@ def main(cmdargs): msgid = msgid.strip('<>') config = get_config_from_git() mboxfile = get_pi_thread_by_msgid(msgid, config, outdir=cmdargs.outdir) - if cmdargs.amready: + if mboxfile and cmdargs.amready: mbox_to_am(mboxfile, config, outdir=cmdargs.outdir, wantver=cmdargs.version) |