Index: src/OFString+Serialization.m ================================================================== --- src/OFString+Serialization.m +++ src/OFString+Serialization.m @@ -22,20 +22,34 @@ #import "OFArray.h" #import "OFXMLElement.h" #import "OFAutoreleasePool.h" #import "OFInvalidArgumentException.h" +#import "OFMalformedXMLException.h" +#import "OFUnboundNamespaceException.h" int _OFString_Serialization_reference; @implementation OFString (Serialization) - (id)objectByDeserializing { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; - OFXMLElement *root = [OFXMLElement elementWithXMLString: self]; + OFXMLElement *root; OFArray *elements; id object; + + @try { + root = [OFXMLElement elementWithXMLString: self]; + } @catch (OFMalformedXMLException *e) { + [e release]; + @throw [OFInvalidArgumentException newWithClass: isa + selector: _cmd]; + } @catch (OFUnboundNamespaceException *e) { + [e release]; + @throw [OFInvalidArgumentException newWithClass: isa + selector: _cmd]; + } elements = [root elementsForNamespace: OF_SERIALIZATION_NS]; if ([elements count] != 1) @throw [OFInvalidArgumentException newWithClass: isa Index: src/exceptions/OFInvalidArgumentException.m ================================================================== --- src/exceptions/OFInvalidArgumentException.m +++ src/exceptions/OFInvalidArgumentException.m @@ -53,11 +53,11 @@ { if (description != nil) return description; description = [[OFString alloc] initWithFormat: - @"The argument for method %s of class %@ is invalid!", + @"The argument or receiver for method %s of class %@ is invalid!", sel_getName(selector), inClass]; return description; }