Skip to content

Commit 1b8cf2a

Browse files
committed
fix: add details to API response on backend
1 parent 50404ee commit 1b8cf2a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

coderd/httpapi/httpapi.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ func ResourceNotFound(rw http.ResponseWriter) {
154154
func Forbidden(rw http.ResponseWriter) {
155155
Write(context.Background(), rw, http.StatusForbidden, codersdk.Response{
156156
Message: "Forbidden.",
157+
Detail: "You don't have permission to view this page. If you believe this is a mistake, please contact your administrator or try signing in with different credentials.",
157158
})
158159
}
159160

site/src/components/Alert/ErrorAlert.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ export const ErrorAlert: FC<
2424
if (status === 403) {
2525
return (
2626
<>
27-
<AlertTitle>You don't have permission to view this page</AlertTitle>
27+
<AlertTitle>{message}</AlertTitle>
2828
<AlertDetail>
29-
If you believe this is a mistake, please contact your administrator
30-
or try signing in with different credentials.{" "}
29+
{detail}{" "}
3130
<Link href="/workspaces" className="w-fit">
3231
Go to workspaces
3332
</Link>

site/src/pages/CreateUserPage/CreateUserPage.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import {
44
renderWithAuth,
55
waitForLoaderToBeRemoved,
66
} from "testHelpers/renderHelpers";
7-
import { Language as FormLanguage } from "./Language";
87
import { CreateUserPage } from "./CreateUserPage";
8+
import { Language as FormLanguage } from "./Language";
99

1010
const renderCreateUserPage = async () => {
1111
renderWithAuth(<CreateUserPage />, {

0 commit comments

Comments
 (0)