Skip to content

Commit

Permalink
Improved error messages for .NET filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nusiq committed Aug 30, 2022
1 parent faef5d5 commit 701c692
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion regolith/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func FilterInstallerFromObject(id string, obj map[string]interface{}) (FilterIns
"Invalid runWith value filter definition.\n"+
"Filter: %s\n"+
"Value: %s\n"+
"Valid values: java, nim, deno, nodejs, python, shell, exe",
"Valid values: java, dotnet, nim, deno, nodejs, python, shell, exe",
runWith, id)
}

Expand Down
16 changes: 9 additions & 7 deletions regolith/filter_dotnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ type DotNetFilter struct {

func DotNetFilterDefinitionFromObject(id string, obj map[string]interface{}) (*DotNetFilterDefinition, error) {
filter := &DotNetFilterDefinition{FilterDefinition: *FilterDefinitionFromObject(id)}
path, ok := obj["path"].(string)
pathObj, ok := obj["path"]
if !ok {
return nil, WrappedErrorf(
"Missing \"path\" property in %s definition.",
FullFilterToNiceFilterName(filter.Id))
return nil, WrappedErrorf(jsonPropertyMissingError, "path")
}
path, ok := pathObj.(string)
if !ok {
return nil, WrappedErrorf(jsonPropertyTypeError, "path", "string")
}
filter.Path = path
return filter, nil
Expand Down Expand Up @@ -68,16 +70,16 @@ func (f *DotNetFilter) run(context RunContext) error {
ShortFilterName(f.Id),
)
if err != nil {
return WrapError(err, "Failed to run .Net filter")
return PassError(err)
}
}
return nil
}

func (f *DotNetFilterDefinition) CreateFilterRunner(runConfiguration map[string]interface{}) (FilterRunner, error) {
basicFilter, err := FilterFromObject(runConfiguration)
basicFilter, err := filterFromObject(runConfiguration)
if err != nil {
return nil, WrapError(err, "Failed to create .Net filter")
return nil, WrapError(err, filterFromObjectError)
}
filter := &DotNetFilter{
Filter: *basicFilter,
Expand Down

0 comments on commit 701c692

Please sign in to comment.