*: Implement collector interface for registry perfdata (#1670)

This commit is contained in:
Jan-Otto Kröpke
2024-10-05 21:33:40 +02:00
committed by GitHub
parent 2a9a11bd01
commit 5952c51a39
53 changed files with 661 additions and 1267 deletions

View File

@@ -1,33 +0,0 @@
package perfdata
import "errors"
// Error represents error returned from Performance Counters API.
type Error struct {
ErrorCode uint32
errorText string
}
func (m *Error) Is(err error) bool {
if err == nil {
return false
}
var e *Error
if errors.As(err, &e) {
return m.ErrorCode == e.ErrorCode
}
return false
}
func (m *Error) Error() string {
return m.errorText
}
func NewPdhError(code uint32) error {
return &Error{
ErrorCode: code,
errorText: PdhFormatError(code),
}
}