From d517b1d0e884f8542f6b1f1c7a9f4ea98f9726d0 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Wed, 16 Feb 2011 23:42:18 +0100 Subject: [PATCH] Use more exceptions. --- src/XMPPJID.m | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/XMPPJID.m b/src/XMPPJID.m index 27c75eb..cdf7a09 100644 --- a/src/XMPPJID.m +++ b/src/XMPPJID.m @@ -21,11 +21,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include - #include #import "XMPPJID.h" +#import "XMPPExceptions.h" @implementation XMPPJID @synthesize node; @@ -82,10 +81,11 @@ } if ((rc = stringprep_profile([node_ cString], &nodepart, - "Nodeprep", 0)) != STRINGPREP_OK) { - of_log(@"Nodeprep failed: %s", stringprep_strerror(rc)); - assert(0); - } + "Nodeprep", 0)) != STRINGPREP_OK) + @throw [XMPPStringPrepFailedException newWithClass: isa + connection: nil + profile: @"Nodeprep" + string: node_]; @try { node = [[OFString alloc] initWithCString: nodepart]; @@ -103,10 +103,11 @@ Stringprep_rc rc; if ((rc = stringprep_profile([domain_ cString], &srv, - "Nameprep", 0)) != STRINGPREP_OK) { - of_log(@"Nameprep failed: %s", stringprep_strerror(rc)); - assert(0); - } + "Nameprep", 0)) != STRINGPREP_OK) + @throw [XMPPStringPrepFailedException newWithClass: isa + connection: nil + profile: @"Nameprep" + string: domain_]; @try { domain = [[OFString alloc] initWithCString: srv]; @@ -130,10 +131,12 @@ } if ((rc = stringprep_profile([resource_ cString], &res, - "Resourceprep", 0)) != STRINGPREP_OK) { - of_log(@"Resourceprep failed: %s", stringprep_strerror(rc)); - assert(0); - } + "Resourceprep", 0)) != STRINGPREP_OK) + @throw [XMPPStringPrepFailedException + newWithClass: isa + connection: nil + profile: @"Resourceprep" + string: resource_]; @try { resource = [[OFString alloc] initWithCString: res];