Dashboard migration: Add missing metrics registration (#110178)

This commit is contained in:
Dominik Prokop
2025-08-29 18:37:39 -06:00
committed by GitHub
parent b22f15ad16
commit 398ed84a60
13 changed files with 1504 additions and 90 deletions
@@ -0,0 +1,42 @@
package conversion
import "fmt"
var _ error = &ConversionError{}
// NewConversionError creates a new ConversionError with the given message, current API version, target API version, and function name
func NewConversionError(msg string, currentAPIVersion, targetAPIVersion string, functionName string) *ConversionError {
return &ConversionError{
msg: msg,
currentAPIVersion: currentAPIVersion,
targetAPIVersion: targetAPIVersion,
functionName: functionName,
}
}
// ConversionError is an error type for conversion errors
type ConversionError struct {
msg string
functionName string
currentAPIVersion string
targetAPIVersion string
}
func (e *ConversionError) Error() string {
return fmt.Sprintf("conversion from %s to %s failed in %s: %s", e.currentAPIVersion, e.targetAPIVersion, e.functionName, e.msg)
}
// GetFunctionName returns the name of the conversion function that failed
func (e *ConversionError) GetFunctionName() string {
return e.functionName
}
// GetCurrentAPIVersion returns the current API version
func (e *ConversionError) GetCurrentAPIVersion() string {
return e.currentAPIVersion
}
// GetTargetAPIVersion returns the target API version
func (e *ConversionError) GetTargetAPIVersion() string {
return e.targetAPIVersion
}