Skip to content

Commit 02a32d2

Browse files
committed
fix: show error when no sdf schema if found
1 parent 8308b1a commit 02a32d2

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/features/SDFViewer/SDFViewer.tsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,34 @@ export const SDFViewer = ({ project, path, file }: SDFViewerProps) => {
2323
data: schema,
2424
error,
2525
isLoading,
26-
} = useGetProjectFile<any>(project, {
27-
path,
28-
file: schemaFilename,
29-
});
26+
} = useGetProjectFile<any>(
27+
project,
28+
{
29+
path,
30+
file: schemaFilename,
31+
},
32+
{
33+
query: {
34+
retry: 0,
35+
},
36+
},
37+
);
3038

3139
const [isEditingConfig, setIsEditingConfig] = useState(true);
3240
const [config, setConfig] = useState<SDFViewerConfig | undefined>(undefined);
3341

3442
if (error) {
3543
// handle error
3644
// SDF schema might not exist
45+
if (error.status === 404) {
46+
return (
47+
<Header title={file}>
48+
<Typography color="error" variant="body1">
49+
No schema found for this SDF
50+
</Typography>
51+
</Header>
52+
);
53+
}
3754
return null;
3855
}
3956

0 commit comments

Comments
 (0)