mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-15 09:26:36 +00:00
chore: Remove registry based perfdata collector (#1742)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
35
internal/perfdata/error.go
Normal file
35
internal/perfdata/error.go
Normal file
@@ -0,0 +1,35 @@
|
||||
//go:build windows
|
||||
|
||||
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),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user