Use exceptions.
This commit is contained in:
parent
fa34006321
commit
8f4e29a466
5 changed files with 234 additions and 41 deletions
|
@ -57,7 +57,8 @@
|
|||
ID: ID_] autorelease];
|
||||
}
|
||||
|
||||
+ stanzaWithElement: (OFXMLElement*)elem {
|
||||
+ stanzaWithElement: (OFXMLElement*)elem
|
||||
{
|
||||
return [[[self alloc] initWithElement: elem] autorelease];
|
||||
}
|
||||
|
||||
|
@ -88,14 +89,14 @@
|
|||
type: (OFString*)type_
|
||||
ID: (OFString*)ID_
|
||||
{
|
||||
if (![name_ isEqual: @"iq"] &&
|
||||
![name_ isEqual: @"message"] &&
|
||||
![name_ isEqual: @"presence"])
|
||||
of_log(@"Invalid stanza name!");
|
||||
|
||||
self = [super initWithName: name_];
|
||||
|
||||
@try {
|
||||
if (![name_ isEqual: @"iq"] && ![name_ isEqual: @"message"] &&
|
||||
![name_ isEqual: @"presence"])
|
||||
@throw [OFInvalidArgumentException newWithClass: isa
|
||||
selector: _cmd];
|
||||
|
||||
[self setDefaultNamespace: @"jabber:client"];
|
||||
|
||||
if (type_)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue