Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Handle unhandled errors in dev server UI #416

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/dev_server/ui/dist/index.html

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions internal/dev_server/ui/src/Flags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function Flags({ selectedProject, flags, setFlags }: FlagProps) {
})
.then(async (res) => {
if (!res.ok) {
return; // todo
throw new Error(`got ${res.status} ${res.statusText}. ${await res.text()}`)
}

const updatedOverrides = {
Expand All @@ -58,9 +58,7 @@ function Flags({ selectedProject, flags, setFlags }: FlagProps) {

setOverrides(updatedOverrides);
})
.catch((_e) => {
// todo
});
.catch( console.error.bind(console, "unable to update override"));
};

const removeOverride = (flagKey: string, updateState: boolean = true) => {
Expand All @@ -71,8 +69,6 @@ function Flags({ selectedProject, flags, setFlags }: FlagProps) {
},
)
.then((res) => {
// todo: clean this up.
//
// In the remove-all-override case, we need to fan out and make the
// request for every override, so we don't want to be interleaving
// local state updates. Expect the consumer to update the local state
Expand All @@ -87,9 +83,7 @@ function Flags({ selectedProject, flags, setFlags }: FlagProps) {
setOnlyShowOverrides(false);
}
})
.catch((_e) => {
// todo
});
.catch( console.error.bind("unable to remove override") );
};

const fetchFlags = async () => {
Expand Down
Loading