Improve exception text.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28281 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2009-05-11 14:33:05 +00:00
parent 18bb5590ce
commit 64abeac596

View file

@ -300,12 +300,13 @@ connectQuote(NSString *str)
} }
str = [NSString stringWithUTF8String: cstr]; str = [NSString stringWithUTF8String: cstr];
[self backendDisconnect]; [self backendDisconnect];
[NSException raise: SQLException format: @"%@ %@", str, stmt]; [NSException raise: SQLException format: @"Error executing %@: %@",
stmt, str];
} }
if (PQresultStatus(result) != PGRES_COMMAND_OK) if (PQresultStatus(result) != PGRES_COMMAND_OK)
{ {
[NSException raise: SQLException format: @"%s", [NSException raise: SQLException format: @"Error executing %@: %s",
PQresultErrorMessage(result)]; stmt, PQresultErrorMessage(result)];
} }
} }
NS_HANDLER NS_HANDLER
@ -316,11 +317,6 @@ connectQuote(NSString *str)
{ {
[self backendDisconnect]; [self backendDisconnect];
} }
if ([self debugging] > 0)
{
[self debug: @"Error executing statement:\n%@\n%@",
stmt, localException];
}
if (result != 0) if (result != 0)
{ {
PQclear(result); PQclear(result);
@ -408,7 +404,8 @@ static unsigned int trim(char *str)
} }
str = [NSString stringWithUTF8String: cstr]; str = [NSString stringWithUTF8String: cstr];
[self backendDisconnect]; [self backendDisconnect];
[NSException raise: SQLException format: @"%@", str]; [NSException raise: SQLException format: @"Error executing %@: %@",
stmt, str];
} }
if (PQresultStatus(result) == PGRES_TUPLES_OK) if (PQresultStatus(result) == PGRES_TUPLES_OK)
{ {
@ -500,8 +497,8 @@ static unsigned int trim(char *str)
} }
else else
{ {
[NSException raise: SQLException format: @"%s", [NSException raise: SQLException format: @"Error executing %@: %s",
PQresultErrorMessage(result)]; stmt, PQresultErrorMessage(result)];
} }
} }
NS_HANDLER NS_HANDLER
@ -512,11 +509,6 @@ static unsigned int trim(char *str)
{ {
[self backendDisconnect]; [self backendDisconnect];
} }
if ([self debugging] > 0)
{
[self debug: @"Error executing statement:\n%@\n%@",
stmt, localException];
}
if (result != 0) if (result != 0)
{ {
PQclear(result); PQclear(result);