Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

less cryptic errors : let's verify the data #2

Closed
tarekziade opened this issue Apr 9, 2012 · 2 comments
Closed

less cryptic errors : let's verify the data #2

tarekziade opened this issue Apr 9, 2012 · 2 comments

Comments

@tarekziade
Copy link
Contributor

When creating a DSKey, if the data does not have what it takes, it breaks without telling what's wrong

let's fix this. in the init I propose to add:

class DSKey(object):
    ...

    def __init__(self, data=None, obj=None):
        ...
        if obj:
            self.dsa = obj
        else:
            for key in ('p', 'q', 'g', 'y'):
                if key not in data:
                    raise ValueError('missing %s in data - %s' % (key, str(data.keys()) ))
            ....

Thoughts ?

@almet
Copy link
Collaborator

almet commented Apr 10, 2012

+1 for me, "explicit is better than implicit" ;)

@almet
Copy link
Collaborator

almet commented Apr 12, 2012

Fixed in e0823cf

@almet almet closed this as completed Apr 12, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants