Skip to content

Commit fe3aa9d

Browse files
Adjust exceptions, to be squashed.
1 parent e1fde7a commit fe3aa9d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/NHibernate/Criterion/EntityProjection.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@ private void SetFields(ICriteriaQuery criteriaQuery)
138138

139139
if (!(criteriaQuery is ISupportEntityProjectionCriteriaQuery entityProjectionQuery))
140140
{
141-
throw new HibernateException($"Projecting to entities requires a '{criteriaQuery.GetType().FullName}' type to implement {nameof(ISupportEntityProjectionCriteriaQuery)} interface.");
141+
throw new ArgumentException(
142+
$"Projecting to entities requires a '{criteriaQuery.GetType().FullName}' type to implement " +
143+
$"{nameof(ISupportEntityProjectionCriteriaQuery)} interface.",
144+
nameof(criteriaQuery));
142145
}
143146

144147
var criteria = entityProjectionQuery.RootCriteria;

src/NHibernate/Criterion/ProjectionsExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ internal static IProjection ProcessMod(MethodCallExpression methodCallExpression
340340
/// </summary>
341341
public static T AsEntity<T>(this T alias) where T:class
342342
{
343-
throw new Exception("Not to be used directly - use inside QueryOver expression");
343+
throw QueryOver.GetDirectUsageException();
344344
}
345345

346346
internal static IProjection ProcessAsEntity(MethodCallExpression methodCallExpression)

0 commit comments

Comments
 (0)