mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-12-24 11:41:02 +00:00
256630c84d
Runtime errors and support for line number reporting with the error.
50 lines
823 B
R
50 lines
823 B
R
#include "Error.h"
|
|
#include "string.h"
|
|
|
|
@implementation Error
|
|
+ (id) type: (string) t message: (string) m by: (SchemeObject) o
|
|
{
|
|
return [[self alloc] initWithType: t message: m by: o];
|
|
}
|
|
|
|
+ (id) type: (string) t message: (string) m
|
|
{
|
|
return [[self alloc] initWithType: t message: m by: NIL];
|
|
}
|
|
|
|
- (id) initWithType: (string) t message: (string) m by: (SchemeObject) o
|
|
{
|
|
self = [super init];
|
|
type = str_new();
|
|
message = str_new();
|
|
str_copy(type, t);
|
|
str_copy(message, m);
|
|
if (o) {
|
|
[self source: [o source]];
|
|
[self line: [o line]];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (BOOL) isError
|
|
{
|
|
return true;
|
|
}
|
|
|
|
- (string) type
|
|
{
|
|
return type;
|
|
}
|
|
|
|
- (string) message
|
|
{
|
|
return message;
|
|
}
|
|
|
|
- (void) dealloc
|
|
{
|
|
str_free(type);
|
|
str_free(message);
|
|
[super dealloc];
|
|
}
|
|
@end
|