Skip to content

Commit

Permalink
make error PluginFaultError when plugin seems have a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rmatsuoka committed Nov 18, 2024
1 parent a36ca05 commit b82d1ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions metrics/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (g *pluginGenerator) loadPluginMeta() error {
pluginMetaEnv := pluginConfigurationEnvName + "=1"
stdout, stderr, exitCode, err := g.Config.Command.RunWithEnv([]string{pluginMetaEnv})
if err != nil {
return fmt.Errorf("running %s failed: %s, exit=%d stderr=%q", g.Config.Command.CommandString(), err, exitCode, stderr)
return &PluginFaultError{fmt.Errorf("running %s failed: %s, exit=%d stderr=%q", g.Config.Command.CommandString(), err, exitCode, stderr)}
}

outBuffer := bufio.NewReader(strings.NewReader(stdout))
Expand Down Expand Up @@ -170,7 +170,7 @@ func (g *pluginGenerator) loadPluginMeta() error {
err = json.NewDecoder(outBuffer).Decode(conf)

if err != nil {
return fmt.Errorf("while reading plugin configuration: %s", err)
return &PluginFaultError{fmt.Errorf("while reading plugin configuration: %s", err)}
}

g.Meta = conf
Expand Down

0 comments on commit b82d1ab

Please sign in to comment.