diff --git a/gossiper.go b/gossiper.go index b75e4f8..3728abf 100644 --- a/gossiper.go +++ b/gossiper.go @@ -56,8 +56,8 @@ func LogAction(action string, data any) { } // NewServiceError creates a new internal.ServiceError instance. -func NewServiceError(message string) *internal.ServiceError { - return internal.NewServiceError(message) +func NewServiceError(message string, statusCode ...int) *internal.ServiceError { + return internal.NewServiceError(message, statusCode...) } // Enum with aliases for predefined pagination page length. diff --git a/internal/index.go b/internal/index.go index 9459596..0db8620 100644 --- a/internal/index.go +++ b/internal/index.go @@ -85,6 +85,6 @@ const ( type ServiceError = errors.ServiceError // NewServiceError creates a new instance of errors.ServiceError with the provided message. -func NewServiceError(message string) *errors.ServiceError { - return errors.NewServiceError(message) +func NewServiceError(message string, statusCode ...int) *ServiceError { + return errors.NewServiceError(message, statusCode...) } diff --git a/internal/tools/formats/errors/error.go b/internal/tools/formats/errors/error.go index 63802f4..ed02ec5 100644 --- a/internal/tools/formats/errors/error.go +++ b/internal/tools/formats/errors/error.go @@ -16,7 +16,7 @@ func (e *ServiceError) Error() string { } // GetError returns a map representing the error status code and message. -func (e *ServiceError) GetError() map[string]interface{} { +func (e *ServiceError) GetError() map[string]any { return map[string]any{ "message": e.Message, "statusCode": e.StatusCode, diff --git a/internal/tools/satisfies.go b/internal/tools/satisfies.go index b21786e..c68768a 100644 --- a/internal/tools/satisfies.go +++ b/internal/tools/satisfies.go @@ -84,7 +84,7 @@ func (inst *Tools) setDefaultsAndConvert(dest any) { // convertFields converts string values in the provided data map to the appropriate types // in the destination struct. It supports converting basic types and pointer types. -func (inst *Tools) convertFields(data map[string]interface{}, dest any) error { +func (inst *Tools) convertFields(data map[string]any, dest any) error { v := reflect.ValueOf(dest).Elem() for key, value := range data { @@ -198,7 +198,7 @@ func (inst *Tools) Satisfies(data any, dest any) error { return err } - if dataMap, ok := data.(map[string]interface{}); ok { + if dataMap, ok := data.(map[string]any); ok { err = inst.convertFields(dataMap, dest) if err != nil { return err