Skip to content

taxedio/tioerrors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

drawing

TIOERRORS

GitHub go.mod Go version (branch) GitHub GitLab Release (custom instance) Gitlab pipeline status Gitlab code coverage GitHub contributors

Go Report Card

Introduction

A basic package to create structs with tags for easy API response building.

Example 1

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: []

Example 2

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]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages