Skip to content

Commit

Permalink
[engine] Add missing error return
Browse files Browse the repository at this point in the history
This return isn't covered by any tests, and I don't see a way it could
be hit unless there's a significant bug in shac (e.g. non-function
Starlark objects are allowed to be registered as checks, which isn't the
case now) or in the starlark-go implementation. But it's best to be safe
in case such a bug does arise.

Change-Id: I3a87b0234ccdddeea583cd29a73df74b9323ab7a
Reviewed-on: https://fuchsia-review.googlesource.com/c/shac-project/shac/+/907842
Fuchsia-Auto-Submit: Oliver Newman <[email protected]>
Reviewed-by: Marc-Antoine Ruel <[email protected]>
Commit-Queue: Marc-Antoine Ruel <[email protected]>
  • Loading branch information
orn688 authored and CQ Bot committed Aug 25, 2023
1 parent 32908fc commit 8717f39
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/engine/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,9 @@ func (c *registeredCheck) call(ctx context.Context, env *starlarkEnv, args starl
if errors.As(err, &evalErr) {
return &evalError{evalErr}
}
// The vast majority of errors should be caught by the above checks, if
// we hit this point there's likely a bug in shac or in starlark-go.
return err
} else if r != starlark.None {
return fmt.Errorf("check %q returned an object of type %s, expected None", c.name, r.Type())
}
Expand Down

0 comments on commit 8717f39

Please sign in to comment.