Skip to content

Commit 1ca9d33

Browse files
authored
Fixed error handling
1 parent 3a54ead commit 1ca9d33

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Jellyfin.HardwareVisualizer/Client/Pages/SubmitSurveyResultPage.razor.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public async Task SubmitResults()
9797
var id = postAsync.Object;
9898
NavigationManager.NavigateTo($"/survey?submission={WebUtility.UrlDecode(id)}");
9999
}
100-
else if (postAsync.StatusCode == HttpStatusCode.BadRequest)
100+
else if (postAsync.StatusCode == HttpStatusCode.BadRequest && postAsync.ErrorResult is not null)
101101
{
102102
var problemDetails = postAsync.ErrorResult;
103103
ValidationErrors.AddRange(problemDetails.Errors.SelectMany(e => e.Value.Select(f => new Error()
@@ -116,6 +116,16 @@ public async Task SubmitResults()
116116
Path = ""
117117
});
118118
}
119+
else
120+
{
121+
ValidationErrors.Add(new Error()
122+
{
123+
Column = 0,
124+
Line = 0,
125+
Message = $"Unkown error submitting the result: {postAsync.StatusMessage} - {postAsync.Object}",
126+
Path = ""
127+
});
128+
}
119129
}
120130

121131
private async Task OnEditorInitialized()

0 commit comments

Comments
 (0)