raml-java-parser icon indicating copy to clipboard operation
raml-java-parser copied to clipboard

Errors with insufficient information about code position.

Open KonstantinSviridov opened this issue 10 years ago • 1 comments

Hi, guys.

Some places in the parser throw exceptions which do not provide information about code position. For example:

java.lang.ClassCastException: org.yaml.snakeyaml.nodes.ScalarNode cannot be cast to org.yaml.snakeyaml.nodes.MappingNode
at org.raml.parser.visitor.TemplateResolver.loopTemplateSequence(TemplateResolver.java:145)
at org.raml.parser.visitor.TemplateResolver.init(TemplateResolver.java:129)
at org.raml.parser.visitor.RamlValidationService.preValidation(RamlValidationService.java:51)
at org.raml.parser.visitor.YamlValidationService.validate(YamlValidationService.java:64)
at org.raml.parser.visitor.YamlValidationService.validate(YamlValidationService.java:95)
at org.raml.parser.visitor.YamlValidationService.validate(YamlValidationService.java:77)

Being able to see positions and messages describing RAML nature of the error would be nice.

Initially the problem arose with RAML->JAX-RS generator. https://github.com/mulesoft/raml-for-jax-rs/issues/103 I post this issue as the generator makes use of the 0.9-SNAPSHOT parser.

Regards, Konstantin.

Aha! Link: https://mulesoft-roadmap.aha.io/features/APIRAML-147

KonstantinSviridov avatar Jun 19 '15 08:06 KonstantinSviridov

Hi folks,

as the original issue was open by me, feel free to ask for snippets, where the problem may be reproduced

Regards, ok11

ok11 avatar Jun 24 '15 08:06 ok11