A basic package to create structs with tags for easy API response building.
package main
import (
"github.com/taxedio/tioerrors"
)
func main(){
restErr := tioerrors.NewRestError("user input incorrect", http.StatusBadRequest, nil)
fmt.Println(restErr)
}console:
message: user input incorrect - status: 400 - error: bad_request - causes: []
package main
import (
"github.com/taxedio/tioerrors"
)
func main(){
var (
errTest []interface{}
)
errTest = append(errTest, "example error")
errTest = append(errTest, "another example error")
restErr := tioerrors.NewRestError("user input incorrect", http.StatusBadRequest, errTest)
fmt.Println(restErr)
}console:
message: user input incorrect - status: 400 - error: bad_request - causes: [example error another example error]
