citeproc-py icon indicating copy to clipboard operation
citeproc-py copied to clipboard

Exception handling issue

Open Ankush-Chander opened this issue 4 years ago • 0 comments

Hi, Thanks for this awesome project.

I am getting following error in my code which is leading to entire formatting to fail.

Traceback (most recent call last):
  File "/work/packages/citeproc-py/citeproc/model.py", line 1463, in _is_uncertain_date
    circa = item.reference[date_variable].get('circa', False)
AttributeError: 'NoneType' object has no attribute 'get'

I tried following snippet and found that AttributeError is not getting caught as VariableError

class VariableError(Exception):
	pass
	
try:
	raise AttributeError("test")
except VariableError:
	print("caught VariableError")
except AttributeError:
	print("caught AttributeError")
except Exception:
	print("caught Exception")
>> caught AttributeError

I intend to raise a pull request handling AttributeError here . Please suggest.

Ankush-Chander avatar Jun 28 '21 10:06 Ankush-Chander