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
2323}
2424
2525async function OpenAPIOperationBody ( props : BlockProps < AnyOpenAPIOperationsBlock > ) {
26- const { block, context } = props ;
26+ const { block, context, style } = props ;
2727
2828 if ( ! context . contentContext ) {
2929 return null ;
@@ -36,11 +36,9 @@ async function OpenAPIOperationBody(props: BlockProps<AnyOpenAPIOperationsBlock>
3636
3737 if ( error ) {
3838 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 >
4442 ) ;
4543 }
4644
Original file line number Diff line number Diff line change 11import { fetchOpenAPIFilesystem } from '@/lib/openapi/fetch' ;
2- import { OpenAPIParseError } from '@gitbook/openapi-parser' ;
2+ import type { OpenAPIParseError } from '@gitbook/openapi-parser' ;
33import { type OpenAPIOperationData , resolveOpenAPIOperation } from '@gitbook/react-openapi' ;
44import type {
55 AnyOpenAPIOperationsBlock ,
@@ -55,8 +55,8 @@ async function baseResolveOpenAPIOperationBlock(
5555
5656 return { data, specUrl } ;
5757 } catch ( error ) {
58- if ( error instanceof OpenAPIParseError ) {
59- return { error } ;
58+ if ( error instanceof Error && error . name === ' OpenAPIParseError' ) {
59+ return { error : error as OpenAPIParseError } ;
6060 }
6161
6262 throw error ;
You can’t perform that action at this time.
0 commit comments