From c6a9a237cb12d7729421a5621835fd33cd21f767 Mon Sep 17 00:00:00 2001 From: Ross Lovas Date: Thu, 2 Feb 2023 17:14:59 +1030 Subject: [PATCH] Include the signature of unsupported method in QueryTranslator exception --- .../QueryableIntegrationFixture.cs | 11 +++++++++++ .../Nevermore/Advanced/Queryable/QueryTranslator.cs | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/source/Nevermore.IntegrationTests/QueryableIntegrationFixture.cs b/source/Nevermore.IntegrationTests/QueryableIntegrationFixture.cs index 77413406..794c0c91 100644 --- a/source/Nevermore.IntegrationTests/QueryableIntegrationFixture.cs +++ b/source/Nevermore.IntegrationTests/QueryableIntegrationFixture.cs @@ -1364,5 +1364,16 @@ public async Task ToListAsync() customers.Select(c => c.LastName).Should().BeEquivalentTo("Apple"); } + + [Test] + public async Task UnsupportedMethod_ShouldThrowNotSupportedException() + { + using var t = Store.BeginTransaction(); + + var runQueryWithUnsupportedMethod = + async () => _ = await t.Queryable().Prepend(new()).ToListAsync(); + + await runQueryWithUnsupportedMethod.Should().ThrowAsync(); + } } } \ No newline at end of file diff --git a/source/Nevermore/Advanced/Queryable/QueryTranslator.cs b/source/Nevermore/Advanced/Queryable/QueryTranslator.cs index 63813ddd..3cb4f97d 100644 --- a/source/Nevermore/Advanced/Queryable/QueryTranslator.cs +++ b/source/Nevermore/Advanced/Queryable/QueryTranslator.cs @@ -183,7 +183,7 @@ protected override Expression VisitMethodCall(MethodCallExpression node) return node; } default: - throw new NotSupportedException(); + throw new NotSupportedException($"Specified method is not supported: {methodInfo}"); } }