Catch invalid versions being passed in, fixes #118
This commit is contained in:
parent
88f49a376a
commit
64319e1246
@ -1,5 +1,4 @@
|
|||||||
# Copyright (C) 2016 Alex Yatskov <alex@foosoft.net>
|
# Copyright 2016-2019 Alex Yatskov
|
||||||
# Author: Alex Yatskov <alex@foosoft.net>
|
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -346,12 +345,13 @@ class AnkiConnect:
|
|||||||
raise Exception('unsupported action')
|
raise Exception('unsupported action')
|
||||||
else:
|
else:
|
||||||
reply['result'] = methodInst(**params)
|
reply['result'] = methodInst(**params)
|
||||||
|
|
||||||
|
if version <= 4:
|
||||||
|
reply = reply['result']
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
reply['error'] = str(e)
|
reply['error'] = str(e)
|
||||||
|
|
||||||
if version <= 4:
|
|
||||||
reply = reply['result']
|
|
||||||
|
|
||||||
if self.log is not None:
|
if self.log is not None:
|
||||||
self.log.write('[reply]\n')
|
self.log.write('[reply]\n')
|
||||||
json.dump(reply, self.log, indent=4, sort_keys=True)
|
json.dump(reply, self.log, indent=4, sort_keys=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user