Improve exception info if XMLRPC parse fails.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22836 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2006-04-28 11:06:16 +00:00
parent c16a063c31
commit 075d73c8b8
2 changed files with 9 additions and 5 deletions

View file

@ -2,7 +2,7 @@
* Source/NSKeyedUnarchiver.m: Fix decoding of NSNull objects. * Source/NSKeyedUnarchiver.m: Fix decoding of NSNull objects.
* Source/Additions/GSXML.m: Ensure that calls to parse documents * Source/Additions/GSXML.m: Ensure that calls to parse documents
handle the success/failure value returned. handle the success/failure value returned. Improve exception info.
2006-04-27 Richard Frith-Macdonald <rfm@gnu.org> 2006-04-27 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -4957,16 +4957,18 @@ static void indentation(unsigned level, NSMutableString *str)
{ {
GSXPathContext *ctx = nil; GSXPathContext *ctx = nil;
GSXPathNodeSet *ns = nil; GSXPathNodeSet *ns = nil;
GSXMLParser *parser = nil;
NSString *method; NSString *method;
[params removeAllObjects]; [params removeAllObjects];
NS_DURING NS_DURING
{ {
GSXMLParser *parser = [GSXMLParser parserWithData: request];
GSXMLDocument *doc = nil; GSXMLDocument *doc = nil;
parser = [GSXMLParser parserWithData: request];
[parser substituteEntities: YES]; [parser substituteEntities: YES];
[parser saveMessages: YES];
if ([parser parse] == YES) if ([parser parse] == YES)
{ {
doc = [parser document]; doc = [parser document];
@ -4981,7 +4983,7 @@ static void indentation(unsigned level, NSMutableString *str)
if (ctx == nil) if (ctx == nil)
{ {
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"Bad Request: parse failed"]; format: @"Bad Request: parse failed (%@)", [parser messages]];
} }
ns = (GSXPathNodeSet*)[ctx evaluateExpression: @"//methodCall/methodName"]; ns = (GSXPathNodeSet*)[ctx evaluateExpression: @"//methodCall/methodName"];
@ -5030,16 +5032,18 @@ static void indentation(unsigned level, NSMutableString *str)
{ {
GSXPathContext *ctx = nil; GSXPathContext *ctx = nil;
GSXPathNodeSet *ns = nil; GSXPathNodeSet *ns = nil;
GSXMLParser *parser = nil;
id fault = nil; id fault = nil;
[params removeAllObjects]; [params removeAllObjects];
NS_DURING NS_DURING
{ {
GSXMLParser *parser = [GSXMLParser parserWithData: response];
GSXMLDocument *doc = nil; GSXMLDocument *doc = nil;
parser = [GSXMLParser parserWithData: response];
[parser substituteEntities: YES]; [parser substituteEntities: YES];
[parser saveMessages: YES];
if ([parser parse] == YES) if ([parser parse] == YES)
{ {
doc = [parser document]; doc = [parser document];
@ -5054,7 +5058,7 @@ static void indentation(unsigned level, NSMutableString *str)
if (ctx == nil) if (ctx == nil)
{ {
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"Bad Response: parse failed"]; format: @"Bad Request: parse failed (%@)", [parser messages]];
} }
ns = (GSXPathNodeSet*)[ctx evaluateExpression: ns = (GSXPathNodeSet*)[ctx evaluateExpression: