ObjPgSQL/exceptions/PGException.m
Jonathan Schleifer dbfce3528e Initial import.
FossilOrigin-Name: de46b0e10c5d9f516acbbf2ea01d84d0d5ac126412949d459265279262a1b87e
2012-10-03 13:20:06 +00:00

44 lines
782 B
Objective-C

#import "PGException.h"
@implementation PGException
+ exceptionWithClass: (Class)class
connection: (PGConnection*)connection
{
return [[[self alloc] initWithClass: class
connection: connection] autorelease];
}
- initWithClass: (Class)class_
connection: (PGConnection*)connection_
{
self = [super initWithClass: class_];
connection = [connection_ retain];
return self;
}
- (void)dealloc
{
[connection release];
[super dealloc];
}
- (OFString*)description
{
if (description != nil)
return description;
description = [[OFString alloc] initWithFormat:
@"A PostgreSQL operation in class %@ failed: %s", inClass,
PQerrorMessage([connection PG_connection])];
return description;
}
- (PGConnection*)connection
{
OF_GETTER(connection, NO)
}
@end