From: Fabio M. (JIRA) <nh...@gm...> - 2011-05-17 22:42:47
|
[ http://216.121.112.228/browse/NH-2039?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo closed NH-2039. --------------------------- Resolution: Obsolete > Explicit error message is lost when a mapping file is missing > ------------------------------------------------------------- > > Key: NH-2039 > URL: http://216.121.112.228/browse/NH-2039 > Project: NHibernate > Issue Type: Patch > Components: Core > Affects Versions: 2.1.2.GA > Reporter: Stéphane Farges > Priority: Minor > > Hi, > I was missing a mapping file but the error was not explicit enough to understand the problem, by debugging, I found the following method in src\NHibernate\Cfg\Configuration.cs, an exception was throw on configuration.classes[className] so the throw new MappingException > was never reached. > private PersistentClass GetPersistentClass(string className) > { > PersistentClass pc = configuration.classes[className]; > if (pc == null) > { > throw new MappingException("persistent class not known: " + className); > } > return pc; > } > If we replace the method with the following code, I think we should get the intended behaviour : > private PersistentClass GetPersistentClass(string className) > { > PersistentClass pc; > if (!configuration.classes.TryGetValue(className, out pc)) > { > throw new MappingException("persistent class not known: " + className); > } > return pc; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |