Skip to content

Commit 5db0bfa

Browse files
fix: types generation graceful error (#541)
1 parent abb3b01 commit 5db0bfa

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

packages/core/src/types/generate-types.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Stream } from '../types-stream'
55
import { generateTypeFromSchema } from './generate-type-from-schema'
66
import { generateTypesFromResponse } from './generate-types-from-response'
77
import { mergeSchemas } from './merge-schemas'
8-
import { JsonSchema, JsonSchemaError } from './schema.types'
8+
import { JsonSchema } from './schema.types'
99

1010
type HandlersMap = Record<string, { type: string; generics: string[] }>
1111
type StreamsMap = Record<string, string>
@@ -56,13 +56,9 @@ export const generateTypesFromSteps = (steps: Step[], printer: Printer): Handler
5656
topics[topic] = generateTypeFromSchema(schema)
5757
topicsSchemas[topic] = schema
5858
} catch (error) {
59-
if (error instanceof JsonSchemaError) {
60-
printer.printInvalidSchema(topic, topicsSteps[topic])
61-
// invalid schema, the topic should be ignored
62-
topics[topic] = 'never'
63-
} else {
64-
throw error
65-
}
59+
printer.printInvalidSchema(topic, topicsSteps[topic])
60+
// invalid schema, the topic should be ignored
61+
topics[topic] = 'never'
6662
}
6763
}
6864
}

0 commit comments

Comments
 (0)