Use more exceptions.

This commit is contained in:
Jonathan Schleifer 2011-02-16 23:42:18 +01:00
parent c61bdf5518
commit d517b1d0e8

View file

@ -21,11 +21,10 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <assert.h>
#include <stringprep.h> #include <stringprep.h>
#import "XMPPJID.h" #import "XMPPJID.h"
#import "XMPPExceptions.h"
@implementation XMPPJID @implementation XMPPJID
@synthesize node; @synthesize node;
@ -82,10 +81,11 @@
} }
if ((rc = stringprep_profile([node_ cString], &nodepart, if ((rc = stringprep_profile([node_ cString], &nodepart,
"Nodeprep", 0)) != STRINGPREP_OK) { "Nodeprep", 0)) != STRINGPREP_OK)
of_log(@"Nodeprep failed: %s", stringprep_strerror(rc)); @throw [XMPPStringPrepFailedException newWithClass: isa
assert(0); connection: nil
} profile: @"Nodeprep"
string: node_];
@try { @try {
node = [[OFString alloc] initWithCString: nodepart]; node = [[OFString alloc] initWithCString: nodepart];
@ -103,10 +103,11 @@
Stringprep_rc rc; Stringprep_rc rc;
if ((rc = stringprep_profile([domain_ cString], &srv, if ((rc = stringprep_profile([domain_ cString], &srv,
"Nameprep", 0)) != STRINGPREP_OK) { "Nameprep", 0)) != STRINGPREP_OK)
of_log(@"Nameprep failed: %s", stringprep_strerror(rc)); @throw [XMPPStringPrepFailedException newWithClass: isa
assert(0); connection: nil
} profile: @"Nameprep"
string: domain_];
@try { @try {
domain = [[OFString alloc] initWithCString: srv]; domain = [[OFString alloc] initWithCString: srv];
@ -130,10 +131,12 @@
} }
if ((rc = stringprep_profile([resource_ cString], &res, if ((rc = stringprep_profile([resource_ cString], &res,
"Resourceprep", 0)) != STRINGPREP_OK) { "Resourceprep", 0)) != STRINGPREP_OK)
of_log(@"Resourceprep failed: %s", stringprep_strerror(rc)); @throw [XMPPStringPrepFailedException
assert(0); newWithClass: isa
} connection: nil
profile: @"Resourceprep"
string: resource_];
@try { @try {
resource = [[OFString alloc] initWithCString: res]; resource = [[OFString alloc] initWithCString: res];