ObjPgSQL  Artifact [2780d9067f]

Artifact 2780d9067fc967ee83024acac1618da4c7eb68f9a4853e4cb3a43f57f5a6b947:

  • File exceptions/PGCommandFailedException.m — part of check-in [12b5ef483a] at 2013-07-23 14:11:42 on branch trunk — Improve exceptions. (user: js size: 777)
  • File src/exceptions/PGCommandFailedException.m — part of check-in [8679c61b2c] at 2014-07-18 23:35:18 on branch trunk — Add a proper build system (user: js size: 777)

#import "PGCommandFailedException.h"

@implementation PGCommandFailedException
+ (instancetype)exceptionWithConnection: (PGConnection*)connection
				command: (OFString*)command
{
	return [[[self alloc] initWithConnection: connection
					 command: command] autorelease];
}

- initWithConnection: (PGConnection*)connection
	     command: (OFString*)command
{
	self = [super initWithConnection: connection];

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

	return self;
}

- (void)dealloc
{
	[_command release];

	[super dealloc];
}

- (OFString*)description
{
	return [OFString stringWithFormat: @"A PostgreSQL command failed: %@\n"
					   @"Command: %@", _error, _command];
}

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