diff --git a/internal/erigon_node/profile.go b/internal/erigon_node/profile.go index 60ecbea..4fa9706 100644 --- a/internal/erigon_node/profile.go +++ b/internal/erigon_node/profile.go @@ -16,25 +16,25 @@ func (c *NodeClient) FindProfile(ctx context.Context, profile string) ([]byte, e request, err := c.fetch(ctx, profile, nil) if err != nil { - return nil, err + return nil, fmt.Errorf("Error fetching profile: %v", err) } _, result, err := request.nextResult(ctx) if err != nil { - return nil, err + return nil, fmt.Errorf("Error fetching profile content: %v", err) } var content ProfileContent if err := json.Unmarshal(result, &content); err != nil { - return nil, err + return nil, fmt.Errorf("Error unmarshalling profile content: %v", err) } //result is a file content so I need to save it to file and return the file path tempFile, err := os.CreateTemp("", "profile-*.pprof") if err != nil { - return nil, err + return nil, fmt.Errorf("Error creating temporary file: %v", err) } defer func() { @@ -49,13 +49,13 @@ func (c *NodeClient) FindProfile(ctx context.Context, profile string) ([]byte, e }() if _, err := tempFile.Write(content.Chunk); err != nil { - return nil, err + return nil, fmt.Errorf("Error writing to temporary file: %v", err) } cmd := exec.Command("go", "tool", "pprof", "-png", tempFile.Name()) svgOutput, err := cmd.Output() if err != nil { - return nil, err + return nil, fmt.Errorf("Error generating SVG output: %v", err) } return svgOutput, nil