File tree 1 file changed +22
-16
lines changed
packages/openapi-parser/src
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: {
19
19
rootURL : string | null ;
20
20
} ) : Promise < Filesystem < OpenAPIV3xDocument > > {
21
21
const { value, rootURL } = input ;
22
- const result = await validate ( value ) ;
23
22
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
+ }
31
32
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
+ }
38
39
39
- const filesystem = await createFileSystem ( { value : result . specification , rootURL } ) ;
40
+ const filesystem = await createFileSystem ( { value : result . specification , rootURL } ) ;
40
41
41
- return filesystem ;
42
+ return filesystem ;
43
+ } catch ( err ) {
44
+ console . error ( err ) ;
45
+ console . trace ( ) ;
46
+ throw err ;
47
+ }
42
48
}
You can’t perform that action at this time.
0 commit comments