Skip to content

Commit

Permalink
Print warning instead of silently ignoring the issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
steipete committed Jan 6, 2014
1 parent b6aa593 commit 7e6d773
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Model/GBStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ -(void)registerTypedefEnum:(GBTypedefEnumData *)typedefEnum
if ([_typedefEnums containsObject:typedefEnum]) return;
GBProtocolData *existingTypedef = [_typedefEnumsByName objectForKey:typedefEnum.nameOfEnum];
if (existingTypedef) {
// Ignore typedef in already refined elsewhere.
return;
}
GBLogWarn(@"Ignoring typedef enum %@, already defined.", typedefEnum);
return;
}

[_typedefEnums addObject:typedefEnum];
[_typedefEnumsByName setObject:typedefEnum forKey:typedefEnum.nameOfEnum];
}
Expand All @@ -130,10 +131,11 @@ - (void)registerDocument:(GBDocumentData *)document {
if ([_documents containsObject:document]) return;
NSString *name = [document.nameOfDocument stringByDeletingPathExtension];
GBDocumentData *existingDocument = [_documentsByName objectForKey:name];
if (existingDocument) {
[NSException raise:@"Document with name %@ is already registered!", name];
return;
}
if (existingDocument) {
GBLogWarn(@"Ignoring document %@, already defined.", document);
return;
}

[_documents addObject:document];
[_documentsByName setObject:document forKey:name];
[_documentsByName setObject:document forKey:[name stringByReplacingOccurrencesOfString:@"-template" withString:@""]];
Expand Down

0 comments on commit 7e6d773

Please sign in to comment.