chore: Update BE http errors to be ui friendly (#1994)

* chore: More UI friendly errors

Mainly capitlization + messages prefix error
This commit is contained in:
Steven Masley
2022-06-03 21:48:09 +00:00
committed by GitHub
parent 847e2b18da
commit c9a4642a12
42 changed files with 544 additions and 317 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ func autostartShow() *cobra.Command {
validSchedule, err := schedule.Weekly(*workspace.AutostartSchedule)
if err != nil {
// This should never happen.
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "invalid autostart schedule %q for workspace %s: %s\n", *workspace.AutostartSchedule, workspace.Name, err.Error())
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Invalid autostart schedule %q for workspace %s: %s\n", *workspace.AutostartSchedule, workspace.Name, err.Error())
return nil
}
+2 -2
View File
@@ -108,7 +108,7 @@ func TestAutostart(t *testing.T) {
clitest.SetupConfig(t, client, root)
err := cmd.Execute()
require.ErrorContains(t, err, "status code 403: forbidden", "unexpected error")
require.ErrorContains(t, err, "status code 403: Forbidden", "unexpected error")
})
t.Run("Disable_NotFound", func(t *testing.T) {
@@ -125,7 +125,7 @@ func TestAutostart(t *testing.T) {
clitest.SetupConfig(t, client, root)
err := cmd.Execute()
require.ErrorContains(t, err, "status code 403: forbidden", "unexpected error")
require.ErrorContains(t, err, "status code 403: Forbidden", "unexpected error")
})
t.Run("Enable_DefaultSchedule", func(t *testing.T) {
+2 -2
View File
@@ -149,7 +149,7 @@ func TestTTL(t *testing.T) {
clitest.SetupConfig(t, client, root)
err := cmd.Execute()
require.ErrorContains(t, err, "status code 403: forbidden", "unexpected error")
require.ErrorContains(t, err, "status code 403: Forbidden", "unexpected error")
})
t.Run("Unset_NotFound", func(t *testing.T) {
@@ -166,6 +166,6 @@ func TestTTL(t *testing.T) {
clitest.SetupConfig(t, client, root)
err := cmd.Execute()
require.ErrorContains(t, err, "status code 403: forbidden", "unexpected error")
require.ErrorContains(t, err, "status code 403: Forbidden", "unexpected error")
})
}