ObjPgSQL  Artifact [aa429f7580]

Artifact aa429f75805bf25c3b7be288c25b62dbde4348ba3583ef8a3bf68657f0e1e67d:


#import "PGCommandFailedException.h"

@implementation PGCommandFailedException
+ exceptionWithClass: (Class)class
	  connection: (PGConnection*)connection
	     command: (OFString*)command
{
	return [[[self alloc] initWithClass: class
				 connection: connection
				    command: command] autorelease];
}

- initWithClass: (Class)class_
     connection: (PGConnection*)connection_
	command: (OFString*)command_
{
	self = [super initWithClass: class_
			 connection: connection_];

	@try {
		command = [command_ copy];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[command release];

	[super dealloc];
}

- (OFString*)description
{
	if (description != nil)
		return description;

	description = [[OFString alloc] initWithFormat:
	    @"A PostgreSQL command in class %@ failed: %s\nCommand: %@",
	    inClass, PQerrorMessage([connection PG_connection]), command];

	return description;
}

- (OFString*)command
{
	OF_GETTER(command, NO)
}
@end