ts-to-io
ts-to-io copied to clipboard
Error: Failed to generate a codec
I have no idea what might be going wrong as the actual problem is not output.
Would you be open to some refactoring with one of the following solutions:
- Early exit with descriptive error message
- Collect error messages and output them when done
For handling/collecting errors, would you prefer Either
from fp-ts
or go dependency free and add another argument on the visitor such as errors: Error[]
?
I'm not yet sure what might be throwing errors in handleDeclaration
and what kind of errors they are, but I guess those errors can be mapped to something more descriptive with file name or original declaration string etc.
I'd like to contribute to get a t-shirt from Octoberfest 😃
Hi, thanks for the info! The error handling side of the project – which is still in a very early stage – could indeed use some improvement. Ideally the error handling should only skip the case of the failed type and process the rest of the types normally. The current logic of catching at the handleDeclaration
level enables this but could be enhanced by logging errors in more detail.
The only case I'm currently aware of that results in processType
throwing is the case of recursive type declarations. At the moment there is no mechanism in place for handling such types and the result is an error. At least this one could be identified to provide better error info to the user. I'm sure there are other edge cases I haven't just encountered yet.
#15 looks like a reasonable step towards making the parser more accessible / discoverable