Skip to content

NH-3988 - Replace ApplicationException with Exception #602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2017

Conversation

hazzik
Copy link
Member

@hazzik hazzik commented Apr 17, 2017

No description provided.

@hazzik hazzik added this to the 5.0.0 milestone Apr 17, 2017
Copy link
Member

@fredericDelaporte fredericDelaporte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had seen those usages of ApplicationException and I was knowing this is an obsolete practice. But well, it does not really harm as far as I know, so I had not proposed to change that. I am for it.

Now I would rather not throw the base Exception class instead on the cases where ApplicationExceptionwas throw. (I am ok with deriving from it of course, this is just the throwing which I dislike.)

@@ -63,15 +63,15 @@ private static ILoggerFactory GetLoggerFactory(string nhibernateLoggerClass)
}
catch (MissingMethodException ex)
{
throw new ApplicationException("Public constructor was not found for " + loggerFactoryType, ex);
throw new Exception("Public constructor was not found for " + loggerFactoryType, ex);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather throw an ArgumentException here (or InvalidOperationException). We should not throw the base Exception class.

}
catch (InvalidCastException ex)
{
throw new ApplicationException(loggerFactoryType + "Type does not implement " + typeof (ILoggerFactory), ex);
throw new Exception(loggerFactoryType + "Type does not implement " + typeof (ILoggerFactory), ex);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous.

}
catch (Exception ex)
{
throw new ApplicationException("Unable to instantiate: " + loggerFactoryType, ex);
throw new Exception("Unable to instantiate: " + loggerFactoryType, ex);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous.

@hazzik
Copy link
Member Author

hazzik commented Apr 21, 2017

Replaced bare Exception with InstantiationException

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants