You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1012 B

package main
import (
"errs"
"errs/stack"
"fmt"
)
func printTrace (s stack.Trace) {
lf := s.Frames()
for i,f := range lf {
fmt.Printf("%d file %s line %d %s\n",i,f.File,f.LineNumber,f.FuncName)
}
}
func GenerateBinaryString() string {
binaryString := ""
for c := 0; c < 255; c++ {
if ('a' <= byte(c) && byte(c) <= 'z') || ('A' <= byte(c) && byte(c) <= 'Z') || byte(c) == '@' {
binaryString += "1"
} else {
binaryString += "0"
}
}
return binaryString
}
type (
MiCustomErr struct {
error
ms string
}
)
func (c MiCustomErr) Message() string {
return "esto es un custom werro"
}
/*
func fm (b *bytes.Buffer, e error, l int) {
b.WriteString("Link :"+e.(MiCustomErr).Link+"\n")
}
*/
func (c MiCustomErr) Unwrap () error {
return c.error
}
func main() {
e := errs.ErrCode("Mi-Error")
i := errs.NewErrInfo(e,
errs.ErrInfoWithMessage("Esto es un mensage"),
errs.ErrInfoWithCause(MiCustomErr{}),
errs.ErrInfoWithStackTrace(2),
)
fmt.Print(i.String())
}

Powered by TurnKey Linux.