Skip to content

Commit

Permalink
Improve a couple of error messages. (#3442)
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamnamboodiripad authored Feb 5, 2024
1 parent ce297e4 commit d351aa2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ internal static HttpDiagnosticInfo InvalidOffset(string expression, string offse
{
var id = $"HTTP0015";
var severity = DiagnosticSeverity.Error;
var messageFormat = "The supplied offset '{1}' in the expression '{0}' is not a valid integer.";
var messageFormat = "The supplied offset '{1}' in the expression '{0}' is not a valid integer. See https://aka.ms/http-date-time-format for more details.";
return new HttpDiagnosticInfo(id, messageFormat, severity, expression, offset);
}

internal static HttpDiagnosticInfo InvalidOption(string expression, string option)
{
var id = $"HTTP0016";
var severity = DiagnosticSeverity.Error;
var messageFormat = "The supplied option '{1}' in the expression '{0}' is not supported.";
var messageFormat = "The supplied option '{1}' in the expression '{0}' is not supported. The following options are supported: ms, s, m, h, d, w, M, Q, y. See https://aka.ms/http-date-time-format for more details.";
return new HttpDiagnosticInfo(id, messageFormat, severity, expression, option);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ public async Task cant_bind_timestamp_offset_with_invalid_option()

var diagnostics = result.Events.Should().ContainSingle<DiagnosticsProduced>().Which;

diagnostics.Diagnostics.First().Message.Should().Be("The supplied option 'q' in the expression '$timestamp -1 q' is not supported.");
diagnostics.Diagnostics.First().Message.Should().Be("The supplied option 'q' in the expression '$timestamp -1 q' is not supported. The following options are supported: ms, s, m, h, d, w, M, Q, y. See https://aka.ms/http-date-time-format for more details.");
}


Expand Down Expand Up @@ -834,7 +834,7 @@ public async Task cant_bind_timestamp_offset_with_invalid_offset()

var diagnostics = result.Events.Should().ContainSingle<DiagnosticsProduced>().Which;

diagnostics.Diagnostics.First().Message.Should().Be("The supplied offset '33.2' in the expression '$timestamp 33.2 d' is not a valid integer.");
diagnostics.Diagnostics.First().Message.Should().Be("The supplied offset '33.2' in the expression '$timestamp 33.2 d' is not a valid integer. See https://aka.ms/http-date-time-format for more details.");
}

[Fact]
Expand Down Expand Up @@ -862,7 +862,7 @@ public async Task cant_bind_timestamp_with_invalid_chars_in_the_arguments()

var result = await kernel.SendAsync(new SubmitCode(code));

result.Events.Should().ContainSingle<DiagnosticsProduced>().Which.Diagnostics.Should().ContainSingle().Which.Message.Should().Be("The supplied offset '~1' in the expression '$timestamp ~1 d' is not a valid integer.");
result.Events.Should().ContainSingle<DiagnosticsProduced>().Which.Diagnostics.Should().ContainSingle().Which.Message.Should().Be("The supplied offset '~1' in the expression '$timestamp ~1 d' is not a valid integer. See https://aka.ms/http-date-time-format for more details.");
}

[Fact]
Expand Down Expand Up @@ -1194,7 +1194,7 @@ public async Task invalid_option_produces_error()
""";

var result = await kernel.SendAsync(new SubmitCode(code));
result.Events.Should().ContainSingle<DiagnosticsProduced>().Which.Diagnostics.Should().ContainSingle().Which.Message.Should().Be("The supplied option 't' in the expression '$datetime 'yyyy-MM-dd' -1 t' is not supported.");
result.Events.Should().ContainSingle<DiagnosticsProduced>().Which.Diagnostics.Should().ContainSingle().Which.Message.Should().Be("The supplied option 't' in the expression '$datetime 'yyyy-MM-dd' -1 t' is not supported. The following options are supported: ms, s, m, h, d, w, M, Q, y. See https://aka.ms/http-date-time-format for more details.");
}

[Fact]
Expand Down

0 comments on commit d351aa2

Please sign in to comment.