Classify invalid artifact relations as input errors

This commit is contained in:
2026-11-20 13:48:55 +00:00
parent 672b7f0ebd
commit 7e45ffca43
5 changed files with 71 additions and 2 deletions

View File

@@ -23,12 +23,24 @@ var memberVariableSelectors = map[string]func(PartyCharacter) string{
"character.alias_summary": func(character PartyCharacter) string { return character.AliasSummary() },
}
// ArtifactCatalogInputError identifies invalid relations in supplied artifact
// configuration. Catalog derivation performs no external I/O.
type ArtifactCatalogInputError struct{ cause error }
func (e *ArtifactCatalogInputError) Error() string { return e.cause.Error() }
func (e *ArtifactCatalogInputError) Unwrap() error { return e.cause }
// DeriveArtifactCatalog interprets the completed pipeline and selected roster
// without changing either native configuration result.
func DeriveArtifactCatalog(cfg *PipelineConfig, party ResolvedParty) (*ArtifactCatalog, error) {
func DeriveArtifactCatalog(cfg *PipelineConfig, party ResolvedParty) (derived *ArtifactCatalog, err error) {
if cfg == nil {
return nil, fmt.Errorf("pipeline config is required")
}
defer func() {
if err != nil {
err = &ArtifactCatalogInputError{cause: err}
}
}()
result := &ArtifactCatalog{Artifacts: map[string]ScriptoriumArtifactConfig{}}
definitionSources := declarationSourceLookup(cfg)
if cfg.Scriptorium == nil {