forked from rosa/hakurei
internal/rosa: improve nil-exec error reporting
This panics with a more descriptive error instead of relying on the SIGSEGV handler. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -994,6 +994,13 @@ type evalContext struct {
|
||||
t Toolchain
|
||||
}
|
||||
|
||||
// HelperError describes a package with nil helper.
|
||||
type HelperError string
|
||||
|
||||
func (e HelperError) Error() string {
|
||||
return "package " + strconv.Quote(string(e)) + " has no exec helper"
|
||||
}
|
||||
|
||||
// pf implements [azalea.PF].
|
||||
func (ctx *evalContext) pf(
|
||||
name azalea.Ident,
|
||||
@@ -1172,6 +1179,10 @@ func (ctx *evalContext) pf(
|
||||
}
|
||||
}
|
||||
|
||||
if helper == nil {
|
||||
panic(HelperError(name))
|
||||
}
|
||||
|
||||
v = cachedArtifact{&meta, ctx.t.New(
|
||||
meta.Name,
|
||||
meta.Version,
|
||||
|
||||
Reference in New Issue
Block a user