Response Error struct added

This commit is contained in:
tanyamadaan
2025-03-19 14:23:44 +05:30
parent 84501b92f4
commit d422743dcc
14 changed files with 35 additions and 928 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"strings"
)
type ErrorType string
@@ -23,6 +24,20 @@ type Error struct {
Paths string `json:"paths,omitempty"`
}
// SchemaValidationErr represents a collection of schema validation failures.
type SchemaValidationErr struct {
Errors []Error
}
// Error implements the error interface for SchemaValidationErr.
func (e *SchemaValidationErr) Error() string {
var errorMessages []string
for _, err := range e.Errors {
errorMessages = append(errorMessages, fmt.Sprintf("%s: %s", err.Paths, err.Message))
}
return strings.Join(errorMessages, "; ")
}
type Message struct {
Ack struct {
Status string `json:"status,omitempty"`