Skip to content

Handle exception returned from YamlParser #2273

Open
@mmvpm

Description

@mmvpm

Description

Please consider handling exception returned from YamlParser.
If YAML document is empty f.i., com.charleskorn.kaml.EmptyYamlDocumentException is thrown to RD and then to IDE:

com.jetbrains.rd.util.reactive.RdFault: The YAML document is empty., reason: com.charleskorn.kaml.EmptyYamlDocumentException at <root> on line 1, column 1: The YAML document is empty.
	at com.charleskorn.kaml.YamlParser.<init>(YamlParser.kt:41)
	at com.charleskorn.kaml.Yaml.parseToYamlNodeFromReader(Yaml.kt:62)
	at com.charleskorn.kaml.Yaml.parseToYamlNode(Yaml.kt:57)
	at org.utbot.taint.parser.yaml.TaintYamlParser.parse(TaintYamlParser.kt:17)

Originally posted by @alisevych in #1966 (comment)

To Reproduce

  1. Enable taint analysis in settings.
  2. Specify syntactically incorrect configuration in the ./.idea/utbot-taint-config.yaml file. (the filename may change due to supporting several taint configs Support several user configs for taint analysis #2272).
  3. Run test generation.

Expected behavior

If the user makes the mistake in the taint analysis configuration, UnitTestBot should display a window with an understandable error (or at least write some information to logs), but should not fail.

Context

See the Taint analysis docs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions