mirror of
https://github.com/hanzoai/agent.git
synced 2026-09-11 21:08:51 +00:00
Consolidate all Hanzo agent infrastructure into one repo: - control-plane/: Go control plane server (was agents-new) - sdk/: Go, Python, TypeScript SDKs - deployments/: Docker, Kubernetes, Helm configs - Dockerfile.sdk: Python SDK image (ghcr.io/hanzoai/agent:latest) - CI builds both SDK + control-plane images No more agentfield — everything is hanzoai/agent.
30 lines
1.0 KiB
Go
30 lines
1.0 KiB
Go
package handlers
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
|
|
"github.com/hanzoai/agents/control-plane/internal/logger"
|
|
)
|
|
|
|
// marshalDataWithLogging marshals data to JSON with proper error handling and logging
|
|
func marshalDataWithLogging(data interface{}, fieldName string) ([]byte, error) {
|
|
if data == nil {
|
|
logger.Logger.Debug().Msgf("🔍 MARSHAL_DEBUG: %s is nil, returning null", fieldName)
|
|
return []byte("null"), nil
|
|
}
|
|
|
|
// Log the type and content of data being marshaled
|
|
logger.Logger.Debug().Msgf("🔍 MARSHAL_DEBUG: Marshaling %s (type: %T)", fieldName, data)
|
|
|
|
// Attempt to marshal with detailed error reporting
|
|
jsonData, err := json.Marshal(data)
|
|
if err != nil {
|
|
logger.Logger.Error().Err(err).Msgf("❌ MARSHAL_ERROR: Failed to marshal %s (type: %T): %v", fieldName, data, data)
|
|
return nil, fmt.Errorf("failed to marshal %s: %w", fieldName, err)
|
|
}
|
|
|
|
logger.Logger.Debug().Msgf("✅ MARSHAL_SUCCESS: Successfully marshaled %s (%d bytes): %s", fieldName, len(jsonData), string(jsonData))
|
|
return jsonData, nil
|
|
}
|