Opened 12 years ago

Closed 11 years ago

#61 closed (wontfix)

validateContactURN() error is confusing

Reported by: sedwards@bbn.com Owned by: somebody
Priority: major Milestone:
Component: Clients Version:
Keywords: v0.6.0 Cc:
Dependencies:

Description

The following code

me = Contact( "Xurn:publicid:IDN+example.com+user+jdoe", givenName="Jane", lastName="Doe", email="jdoe@example.com", phone="555-1234" )
print me

Returns

Traceback (most recent call last):
  File "gmoc_test.py", line 19, in <module>
    me = Contact( "Xurn:publicid:IDN+example.com+user+jdoe", givenName="Jane", lastName="Doe", email="jdoe@example.com", phone="555-1234" )
  File "/home/sedwards/gmoc_client/v0_4_0/gmoc.py", line 497, in __init__
    super(Contact, self).__init__(id)
  File "/home/sedwards/gmoc_client/v0_4_0/gmoc.py", line 331, in __init__
    self.id = id
  File "/home/sedwards/gmoc_client/v0_4_0/gmoc.py", line 270, in __setObjID
    validVal = validator(value)
  File "/home/sedwards/gmoc_client/v0_4_0/gmoc.py", line 184, in validateContactURN
    return URN_PREFIX + '+' + emailParts[1] + '+user+' + emailParts[0]
IndexError: list index out of range

If the URN I pass in as an identifier isn't a URN, it should provide a clear message to that effect.

Change History (2)

comment:1 Changed 12 years ago by sedwards@bbn.com

Keywords: v0.6.0 added; v0.4.0 removed
Milestone: 2012-09-04 client release

I now get:

Traceback (most recent call last):
  File "gmoc_test_obj.py", line 25, in <module>
    phone="555-1234" )
  File "/home/sedwards/monitoring2/monitoring/gmoc_client/gmoc.py", line 500, in __init__
    super(Contact, self).__init__(id)
  File "/home/sedwards/monitoring2/monitoring/gmoc_client/gmoc.py", line 333, in __init__
    self.id = id
  File "/home/sedwards/monitoring2/monitoring/gmoc_client/gmoc.py", line 276, in __setObjID
    raise ValueError("identifier could not be validated")
ValueError: identifier could not be validated

Better but still vague.

comment:2 Changed 11 years ago by chaos@bbn.com

Resolution: wontfix
Status: newclosed

I'm going to close this as wontfix. It's minor, and we need to overhaul invalid URN handling anyway (GMT 119, GMT 149).

Note: See TracTickets for help on using tickets.