File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed
components/DocumentView/OpenAPI Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export async function OpenAPIOperation(props: BlockProps<AnyOpenAPIOperationsBlo
23
23
}
24
24
25
25
async function OpenAPIOperationBody ( props : BlockProps < AnyOpenAPIOperationsBlock > ) {
26
- const { block, context } = props ;
26
+ const { block, context, style } = props ;
27
27
28
28
if ( ! context . contentContext ) {
29
29
return null ;
@@ -36,11 +36,9 @@ async function OpenAPIOperationBody(props: BlockProps<AnyOpenAPIOperationsBlock>
36
36
37
37
if ( error ) {
38
38
return (
39
- < div className = "hidden" >
40
- < p >
41
- Error with { specUrl } : { error . message }
42
- </ p >
43
- </ div >
39
+ < p aria-hidden className = { tcls ( style ) } >
40
+ Error while loading OpenAPI operation — { error . message }
41
+ </ p >
44
42
) ;
45
43
}
46
44
Original file line number Diff line number Diff line change 1
1
import { fetchOpenAPIFilesystem } from '@/lib/openapi/fetch' ;
2
- import { OpenAPIParseError } from '@gitbook/openapi-parser' ;
2
+ import type { OpenAPIParseError } from '@gitbook/openapi-parser' ;
3
3
import { type OpenAPIOperationData , resolveOpenAPIOperation } from '@gitbook/react-openapi' ;
4
4
import type {
5
5
AnyOpenAPIOperationsBlock ,
@@ -55,8 +55,8 @@ async function baseResolveOpenAPIOperationBlock(
55
55
56
56
return { data, specUrl } ;
57
57
} catch ( error ) {
58
- if ( error instanceof OpenAPIParseError ) {
59
- return { error } ;
58
+ if ( error instanceof Error && error . name === ' OpenAPIParseError' ) {
59
+ return { error : error as OpenAPIParseError } ;
60
60
}
61
61
62
62
throw error ;
You can’t perform that action at this time.
0 commit comments