Skip to content

Commit

Permalink
Fixed error message for when a table, object, or scaler are not retur…
Browse files Browse the repository at this point in the history
…ned by the query.
  • Loading branch information
daemogar committed Mar 13, 2024
1 parent fe0e247 commit 35f08ea
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion SQuiL.SourceGenerator/SQuiL/Models/SQuiLDataContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ void Process()
if (outputs.Count > 0)
{
foreach (var block in outputs.Select(p => p.CodeBlock).OrderBy(p => p.IsObject ? 1 : p.IsTable ? 2 : 0))
writer.WriteLine($"""if (!is{block.Name}) throw new Exception("Expected return table `{block.Name}`)");""");
{
var type = block.IsObject ? "object" : block.IsTable ? "table" : "scaler";
var missingErrorMessage = $"Expected return {type} `{block.Name}`)";
writer.WriteLine($"""if (!is{block.Name}) throw new Exception("{missingErrorMessage}");""");
}
writer.WriteLine();
}
Expand Down

0 comments on commit 35f08ea

Please sign in to comment.