Sphire Mantis API Documentation

Sphire Mantis' API Documentation

View the Project on GitHub sphireinc/Mantis

Go Report Card Go Reference

errors

import "github.com/sphireinc/mantis/errors"

Index

type Errors

Errors holds our code, message, timestamp

type Errors struct {
    code      int32
    message   string
    timestamp time.Time
}

func New

func New(code int32, message string, args []any) *Errors

New creates a new errors instance Usage:

err = New(100, "%v is %v years old", []any{"Kim", 22})
- or without args -
 err := New(100, "some message", nil)

func (*Errors) Code

func (e *Errors) Code() int32

Code returns the error code

func (*Errors) Marshal

func (e *Errors) Marshal() error

Marshal creates a Go STD error from our Errors object

func (*Errors) MarshalJSON

func (e *Errors) MarshalJSON() ([]byte, error)

MarshalJSON implements the JSON encoding interface

func (*Errors) Message

func (e *Errors) Message() string

Message returns the error message

func (*Errors) Time

func (e *Errors) Time() time.Time

Time returns the error timestamp

Generated by gomarkdoc