westerveltco / django-opfield

A custom Django field for storing and securely accessing a 1Password vault item
https://django-opfield.westervelt.dev
MIT License
3 stars 0 forks source link

Change exception raised if `op` CLI not available to `RuntimeError` #11

Closed joshuadavidthomas closed 2 months ago

joshuadavidthomas commented 2 months ago

ImportError is the wrong exception to raise here:

Raised when the import statement has troubles trying to load a module. Also raised when the “from list” in from ... import has a name that cannot be found.

RuntimeError seems much more appropriate:

Raised when an error is detected that doesn’t fall in any of the other categories. The associated value is a string indicating what precisely went wrong.

https://github.com/westerveltco/django-opfield/blob/41e713dee7053a52aeda6071ccf2ded334184c6e/src/django_opfield/conf.py#L54