Skip to content

Commit

Permalink
show error message when wrong workflow id (#3474)
Browse files Browse the repository at this point in the history
  • Loading branch information
CarinaWolli committed Jul 21, 2022
1 parent 0a336df commit c500952
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
24 changes: 16 additions & 8 deletions apps/web/ee/pages/workflows/[workflow].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ function WorkflowPage() {

const {
data: workflow,
isError,
error,
isLoading,
dataUpdatedAt,
} = trpc.useQuery([
Expand Down Expand Up @@ -153,15 +155,21 @@ function WorkflowPage() {
<Alert className="border " severity="warning" title={t("pro_feature_workflows")} />
) : (
<>
{isAllDataLoaded ? (
<WorkflowDetailsPage
form={form}
workflowId={+workflowId}
selectedEventTypes={selectedEventTypes}
setSelectedEventTypes={setSelectedEventTypes}
/>
{!isError ? (
<>
{isAllDataLoaded ? (
<WorkflowDetailsPage
form={form}
workflowId={+workflowId}
selectedEventTypes={selectedEventTypes}
setSelectedEventTypes={setSelectedEventTypes}
/>
) : (
<Loader />
)}
</>
) : (
<Loader />
<Alert severity="error" title="Something went wrong" message={error.message} />
)}
</>
)}
Expand Down
5 changes: 5 additions & 0 deletions apps/web/server/routers/viewer/workflows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ export const workflowsRouter = createProtectedRouter()
},
},
});
if (!workflow) {
throw new TRPCError({
code: "UNAUTHORIZED",
});
}
return workflow;
},
})
Expand Down

0 comments on commit c500952

Please sign in to comment.