Skip to content

Improve error messages by adding helpful context #1836

@douglascamata

Description

@douglascamata

Is your feature request related to a problem? Please describe.

I'm currently trying to debug an issue when running github.com/shirou/gopsutil/v4/host.Info() in a Windows 2019 k8s node and for some reason it fails (I could already figure out the reason, but it's not the focus here). The error message is short and not helpful:

The system cannot find the file specified.

There's no information about which one of the InfoStat fields caused the issue and which file cannot be found.

Describe the solution you'd like

I would like the error to provide all the additional context related to the error. For example, if the problem happens when trying to fill in the InfoStat.KernelVersion field:

KernelVersion: the system cannot find the file "<whatever file it tried to find>"

Describe alternatives you've considered

None so far.

Additional context

None so far.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions