ObjPgSQL/exceptions/PGCommandFailedException.m
Jonathan Schleifer b3eaf2f272 Prefix all ivars with an underscore.
FossilOrigin-Name: 8c8a4313228bba7114d582a6802a2df53a1fb357f5c0805ae58531dd4c799d8c
2013-02-13 23:40:58 +00:00

49 lines
913 B
Objective-C

#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
{
return [OFString stringWithFormat:
@"A PostgreSQL command in class %@ failed: %s\nCommand: %@",
[self inClass], PQerrorMessage([_connection PG_connection]),
_command];
}
- (OFString*)command
{
OF_GETTER(_command, NO)
}
@end