 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Variables
- type Error
- func (e Error) Append(format string, a ...interface{}) Error
- func (e Error) AppendErr(err error) Error
- func (e Error) Error() string
- func (e Error) Format(a ...interface{}) Error
- func (e Error) IsAppended() bool
- func (e Error) Panic()
- func (e Error) Panicf(args ...interface{})
- func (e Error) String() string
- func (e Error) With(err error) error
 
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Prefix the error prefix, applies to each error's message. Prefix = "" // NewLine adds a new line to the end of each error's message // defaults to true NewLine = true )
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
	// contains filtered or unexported fields
}
    Error holds the error message, this message never really changes
Example ¶
package main
import (
	"fmt"
	"github.com/go-siris/siris/core/errors"
)
var errMessage = "User with mail: %s already exists"
var errUserAlreadyExists = errors.New(errMessage)
var userMail = "user1@mail.go"
func main() {
	fmt.Print(errUserAlreadyExists.Format(userMail))
	// first output first Output line
	fmt.Print(errUserAlreadyExists.Format(userMail).Append("Please change your mail addr"))
	// second output second and third Output lines
}
Output: User with mail: user1@mail.go already exists User with mail: user1@mail.go already exists Please change your mail addr
func New ¶
New creates and returns an Error with a pre-defined user output message all methods below that doesn't accept a pointer receiver because actually they are not changing the original message
func (Error) Append ¶
Append adds a message to the predefined error message and returns a new error it does NOT change the original error's message
func (Error) AppendErr ¶
AppendErr adds an error's message to the predefined error message and returns a new error it does NOT change the original error's message
func (Error) Error ¶
Error returns the message of the actual error implements the error
func (Error) Format ¶
Format returns a formatted new error based on the arguments it does NOT change the original error's message
func (Error) IsAppended ¶
IsAppended returns true if the Error instance is created using original's Error.Append/AppendErr func
       Source Files
      ¶
      Source Files
      ¶
    
- errors.go