File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
frontend/packages/pydantic-forms/src/core/hooks Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -19,13 +19,18 @@ export function useRefParser(
19
19
return useSWR < PydanticFormSchemaParsed | undefined > (
20
20
[ id , rawJsonSchema ] ,
21
21
async ( [ , source ] ) => {
22
- if ( ! source ) {
23
- return undefined ;
22
+ try {
23
+ if ( ! source ) {
24
+ return undefined ;
25
+ }
26
+ const parsedSchema = ( await $RefParser . dereference ( source , {
27
+ mutateInputSchema : false ,
28
+ } ) ) as unknown as PydanticFormSchemaParsed ;
29
+ return parsedSchema ;
30
+ } catch ( error ) {
31
+ console . error ( error ) ;
32
+ throw new Error ( 'Could not parse JSON references' ) ;
24
33
}
25
- const parsedSchema = ( await $RefParser . dereference ( source , {
26
- mutateInputSchema : false ,
27
- } ) ) as unknown as PydanticFormSchemaParsed ;
28
- return parsedSchema ;
29
34
} ,
30
35
{
31
36
fallback : { } ,
You can’t perform that action at this time.
0 commit comments