ObjPgSQL  PGException.m at [f069ee6cec]

File exceptions/PGException.m artifact 603d30aa28 part of check-in f069ee6cec


#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
{
	return [OFString stringWithFormat:
	    @"A PostgreSQL operation in class %@ failed: %s", [self inClass],
	    PQerrorMessage([_connection PG_connection])];
}

- (PGConnection*)connection
{
	OF_GETTER(_connection, NO)
}
@end