Last change
on this file since 277 was 53, checked in by Nicholas Riley, 22 years ago |
Updated for Pester 1.1a5 (very limited release).
Pester 1.1a4 was never released.
|
File size:
1.2 KB
|
Rev | Line | |
---|
[53] | 1 | //
|
---|
| 2 | // PSError.m
|
---|
| 3 | // Pester
|
---|
| 4 | //
|
---|
| 5 | // Created by Nicholas Riley on Sun Dec 29 2002.
|
---|
| 6 | // Copyright (c) 2002 Nicholas Riley. All rights reserved.
|
---|
| 7 | //
|
---|
| 8 |
|
---|
| 9 | #import "PSError.h"
|
---|
| 10 |
|
---|
| 11 | static NSString * const PSErrorException = @"PSErrorException";
|
---|
| 12 |
|
---|
| 13 | @implementation PSError
|
---|
| 14 |
|
---|
| 15 | + (PSError *)error;
|
---|
| 16 | {
|
---|
| 17 | return [[self alloc] init];
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | - (void)dealloc;
|
---|
| 21 | {
|
---|
| 22 | [reasons release]; reasons = nil;
|
---|
| 23 | [operation release]; operation = nil;
|
---|
| 24 | [super dealloc];
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | - (NSCountedSet *)reasons;
|
---|
| 28 | {
|
---|
| 29 | if (reasons == nil)
|
---|
| 30 | reasons = [[NSCountedSet alloc] initWithCapacity: 2];
|
---|
| 31 | return reasons;
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | - (void)addException:(NSException *)exception;
|
---|
| 35 | {
|
---|
| 36 |
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | - (void)raiseIfNeededForOperation:(NSString *)anOperation count:(unsigned)aCount;
|
---|
| 40 | {
|
---|
| 41 | if (reasons != nil && [reasons count] > 0) {
|
---|
| 42 | // NSMutableString *
|
---|
| 43 | [self autorelease];
|
---|
| 44 | [NSException raise: PSErrorException
|
---|
| 45 | format: @"Pester encountered errors while %@ %@."];
|
---|
| 46 | } else {
|
---|
| 47 | [self release];
|
---|
| 48 | }
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | @end
|
---|
| 52 |
|
---|
| 53 | /* Use cases:
|
---|
| 54 | - PSAlerts => can't restore one or more alerts, keep the rest
|
---|
| 55 | -
|
---|
| 56 |
|
---|
| 57 | Need to add error to initWithPropertyList: protocol, otherwise we can't get back partially-formed objects.
|
---|
| 58 | - (id)initWithPropertyList:(NSDictionary *)dict error:(PSException **)exception;
|
---|
| 59 |
|
---|
| 60 | */ |
---|
Note:
See
TracBrowser
for help on using the repository browser.