ObjPgSQL  PGException.m at [8c8a431322]

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


#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