File tree Expand file tree Collapse file tree 1 file changed +22
-16
lines changed
packages/openapi-parser/src Expand file tree Collapse file tree 1 file changed +22
-16
lines changed Original file line number Diff line number Diff line change @@ -19,24 +19,30 @@ export async function parseOpenAPIV3(input: {
1919 rootURL : string | null ;
2020} ) : Promise < Filesystem < OpenAPIV3xDocument > > {
2121 const { value, rootURL } = input ;
22- const result = await validate ( value ) ;
2322
24- // Spec is invalid, we stop here.
25- if ( ! result . specification ) {
26- throw new OpenAPIParseError ( 'Invalid OpenAPI document' , {
27- code : 'invalid' ,
28- rootURL,
29- } ) ;
30- }
23+ try {
24+ const result = await validate ( value ) ;
25+ // Spec is invalid, we stop here.
26+ if ( ! result . specification ) {
27+ throw new OpenAPIParseError ( 'Invalid OpenAPI document' , {
28+ code : 'invalid' ,
29+ rootURL,
30+ } ) ;
31+ }
3132
32- if ( result . version === '2.0' ) {
33- throw new OpenAPIParseError ( 'Only OpenAPI v3 is supported' , {
34- code : 'parse-v2-in-v3' ,
35- rootURL,
36- } ) ;
37- }
33+ if ( result . version === '2.0' ) {
34+ throw new OpenAPIParseError ( 'Only OpenAPI v3 is supported' , {
35+ code : 'parse-v2-in-v3' ,
36+ rootURL,
37+ } ) ;
38+ }
3839
39- const filesystem = await createFileSystem ( { value : result . specification , rootURL } ) ;
40+ const filesystem = await createFileSystem ( { value : result . specification , rootURL } ) ;
4041
41- return filesystem ;
42+ return filesystem ;
43+ } catch ( err ) {
44+ console . error ( err ) ;
45+ console . trace ( ) ;
46+ throw err ;
47+ }
4248}
You can’t perform that action at this time.
0 commit comments