Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » LoadFromXML problem and solution
LoadFromXML problem and solution [message #36715] Thu, 28 June 2012 17:36 Go to next message
koldo is currently online  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello Mirek

Now LoadFromXML() catches only XmlError.

However if XmlizeByJsonize() is used, Jsonize() throws a JsonizeError. This way LoadFromXML cannot catch Json errors.

The solution would be just to replace catch(XmlError) {} with catch(...) {} in LoadFromXML().


Best regards
Iñaki
Re: LoadFromXML problem and solution [message #36727 is a reply to message #36715] Fri, 29 June 2012 13:47 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
catch(...) is too quirky IMO. I have rather used
template <class T>
void XmlizeByJsonize(XmlIO& xio, T& x)
{
	if(xio.IsStoring())
		StoreJsonValue(xio, StoreAsJsonValue(x));
	else {
		try {
			LoadFromJsonValue(x, LoadJsonValue(xio.Node()));
		}
		catch(JsonizeError e) {
			throw XmlError("xmlize by jsonize error: " + e);
		}
	}
}


please check..

Mirek
Re: LoadFromXML problem and solution [message #36749 is a reply to message #36727] Sun, 01 July 2012 19:24 Go to previous message
koldo is currently online  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Ok Smile

Best regards
Iñaki
Previous Topic: why use fromsyschrset in the first sentence of the logfile?
Next Topic: XmlizeByJsonize() problem and proposed solution
Goto Forum:
  


Current Time: Thu Mar 28 13:47:27 CET 2024

Total time taken to generate the page: 0.00963 seconds