Skip to content

MarshalStream eats error message details #3893

Closed as not planned
Closed as not planned
@grihabor

Description

@grihabor

Is your feature request related to a problem? Please describe.
Here is an example:

import (
	"encoding/yaml"
)

config: {
	a: int
	b: string
	c: 42
}

output: yaml.MarshalStream([config])

Now if I run

cue export --expression output ./main.cue 

it says

output: error in call to encoding/yaml.MarshalStream: incomplete value _:
    ./main.cue:11:9

which doesn't tell me anything about which fields are incomplete.

Meanwhile, if I run

cue export --expression config ./main.cue

it shows exactly what's wrong

config.a: incomplete value int:
    ./main.cue:6:5
config.b: incomplete value string:
    ./main.cue:7:5

Describe the solution you'd like
In my example, I want the output for the command

cue export --expression output ./main.cue

be something like

output.0.config.a: incomplete value int:
    ./main.cue:6:5
output.0.config.b: incomplete value string:
    ./main.cue:7:5

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestNew feature or requestTriageRequires triage/attention

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions