stage: make the unmarshalling error more verbose

Prior this commit there was no information in the log about the unrecognized
stage. This commit adds the stage name to the unmarshalling error.
This commit is contained in:
Ondřej Budai 2020-03-17 10:28:28 +01:00
parent 7a3c82a405
commit 54e27e607c

View file

@ -2,7 +2,7 @@ package osbuild
import (
"encoding/json"
"errors"
"fmt"
)
// A Stage transforms a filesystem tree.
@ -67,7 +67,7 @@ func (stage *Stage) UnmarshalJSON(data []byte) error {
case "org.osbuild.script":
options = new(ScriptStageOptions)
default:
return errors.New("unexpected stage name")
return fmt.Errorf("unexpected stage name: %s", rawStage.Name)
}
err = json.Unmarshal(rawStage.Options, options)
if err != nil {