Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function OpenAPIOperation(props: BlockProps<AnyOpenAPIOperationsBlo
}

async function OpenAPIOperationBody(props: BlockProps<AnyOpenAPIOperationsBlock>) {
const { block, context } = props;
const { block, context, style } = props;

if (!context.contentContext) {
return null;
Expand All @@ -36,11 +36,9 @@ async function OpenAPIOperationBody(props: BlockProps<AnyOpenAPIOperationsBlock>

if (error) {
return (
<div className="hidden">
<p>
Error with {specUrl}: {error.message}
</p>
</div>
<p aria-hidden className={tcls(style)}>
Error while loading OpenAPI operation — {error.message}
</p>
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fetchOpenAPIFilesystem } from '@/lib/openapi/fetch';
import { OpenAPIParseError } from '@gitbook/openapi-parser';
import type { OpenAPIParseError } from '@gitbook/openapi-parser';
import { type OpenAPIOperationData, resolveOpenAPIOperation } from '@gitbook/react-openapi';
import type {
AnyOpenAPIOperationsBlock,
Expand Down Expand Up @@ -55,8 +55,8 @@ async function baseResolveOpenAPIOperationBlock(

return { data, specUrl };
} catch (error) {
if (error instanceof OpenAPIParseError) {
return { error };
if (error instanceof Error && error.name === 'OpenAPIParseError') {
return { error: error as OpenAPIParseError };
}

throw error;
Expand Down