fix: error coverage

This commit is contained in:
mayur.popli
2025-03-25 02:52:44 +05:30
parent 7db185fdfb
commit ce70a467b9
4 changed files with 126 additions and 111 deletions

View File

@@ -6,24 +6,20 @@ import (
"strings"
)
// Error represents an error response.
type Error struct {
Code string `json:"code"`
Paths string `json:"paths,omitempty"`
Message string `json:"message"`
}
// Error implements the error interface for the Error struct.
func (e *Error) Error() string {
return fmt.Sprintf("Error: Code=%s, Path=%s, Message=%s", e.Code, e.Paths, e.Message)
}
// 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 {
@@ -39,8 +35,6 @@ func (e *SchemaValidationErr) BecknError() *Error {
Message: "Schema validation error.",
}
}
// Collect all error paths and messages
var paths []string
var messages []string
for _, err := range e.Errors {
@@ -57,7 +51,6 @@ func (e *SchemaValidationErr) BecknError() *Error {
}
}
// SignalidationErr represents a collection of schema validation failures.
type SignValidationErr struct {
error
}
@@ -77,7 +70,6 @@ func (e *SignValidationErr) BecknError() *Error {
}
}
// SignalidationErr represents a collection of schema validation failures.
type BadReqErr struct {
error
}
@@ -97,7 +89,6 @@ func (e *BadReqErr) BecknError() *Error {
}
}
// SignalidationErr represents a collection of schema validation failures.
type NotFoundErr struct {
error
}