feat: some experiments

This commit is contained in:
Max Richter
2025-09-26 17:32:16 +02:00
parent ea978b48f6
commit 8ca5152c3c
12 changed files with 147 additions and 66 deletions

View File

@@ -25,7 +25,7 @@ type yamlField struct {
PathAlias []string `yaml:"pathAlias,omitempty"`
}
func parseYamlTemplate(input string) (block Block, err error) {
func parseYamlTemplate(input Slice) (block Block, err error) {
var blk yamlBlock
cleaned := cleanTemplate(input)
@@ -34,7 +34,7 @@ func parseYamlTemplate(input string) (block Block, err error) {
dec.KnownFields(true)
if err := dec.Decode(&blk); err != nil {
return block, fmt.Errorf("content '%q': %w", cleaned, err)
return block, NewErrorf("content '%q' -> %w", cleaned, err).WithPosition(input.start, input.end)
}
if blk.Path == "" {
@@ -47,7 +47,7 @@ func parseYamlTemplate(input string) (block Block, err error) {
codec, err := parseCodecType(blk.Codec)
if err != nil {
return block, fmt.Errorf("failed to parse codec: %w", err)
return block, fmt.Errorf("failed to parse codec -> %w", err)
}
var fields []BlockField
@@ -63,7 +63,7 @@ func parseYamlTemplate(input string) (block Block, err error) {
fieldCodec, err := parseCodecType(field.Codec)
if err != nil {
return block, fmt.Errorf("failed to parse codec: %w", err)
return block, fmt.Errorf("failed to parse codec -> %w", err)
}
fields = append(fields, BlockField{