package main import ( "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) } } 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() { /* for c := ftext.ColorBlack; c <= ftext.ColorWhite; c++ { fmt.Print(c.SprintfColor("Color %d %s ******\n",c,c.Name())) } */ fmt.Printf("\n \x1b[32;43m sdasd \x1b[0m \n" ) fmt.Printf("\n \x1b[92;43m sdasd \x1b[0m \n" ) fmt.Printf("\n \x1b[1;4;32;43m sdasd \x1b[0m \n" ) fmt.Printf("\n \x1b[1;4;92;103m sdasd \x1b[0m \n" ) fmt.Printf("\n \x1b[1;4;5;92;43m sdasd \x1b[0m \n" ) /* color := ansi.ColorBlue fmt.Printf("Colores %d (%d:%d) escapes = %s\n",color,color.Foreground(),color.Background(),color.Escape()) color = color.SetForeground(ansi.ColorGreen).SetBackground(ansi.ColorYellow) fmt.Printf("Colores %d (%d:%d) escapes = %s\n",color,color.Foreground(),color.Background(),color.Escape()) color = color.SetForeground(ansi.ColorCyan) fmt.Printf("Colores %d (%d:%d) escapes = %s\n",color,color.Foreground(),color.Background(),color.Escape()) color = color.SetColors(ansi.ColorWhite,ansi.ColorBlack) fmt.Printf("Colores %d (%d:%d) escapes = %s\n",color,color.Foreground(),color.Background(),color.Escape()) */ /* ercode := errs.ErrCode("error->err-code") //fmt.Print(errs.ToFormat(ercode,nil)) //fmt.Print("\n") erpanic := errs.NewErrPanic(errs.PanicRecoveredError("error->err-mensaje-panico")) fmt.Print(errs.ToFormat(erpanic,nil)) fmt.Print("\n") panicInfo := erpanic.WrapWithInfo(errs.ErrInfoWithMessage("Un mensaje de panico")) fmt.Print(errs.ToFormat(panicInfo,nil)) fmt.Print("\n") ercause := ercode.WrapWithCause(errs.ErrCode("causa-2").WrapWithCause(errs.ErrCode("causa-1"))) fmt.Print(errs.ToFormat(ercause,nil)) fmt.Print("\n") erInfo := errs.ErrCode("err-code-with-info").WrapWithInfo(errs.ErrInfoWithMessage("Esto es un mensaje")) fmt.Print(errs.ToFormat(erInfo,nil)) fmt.Print("\n") fmt.Print(string(errs.G.Formatter.Format(&MiCustomErr{error:errs.ErrCode("UnErrorCU") }))) fmt.Print("\n") */ // fmt.Print(errs.ToFormat(errs.NewErrParam("MiParamatro","invalid paearmtro %s con valor %v","MiParam",343).WrapWithTrace(2),nil)) /* ertrace := errs.ErrCode("err-code-with-trace").ToErrTrace(0) fmt.Print(ertrace.StringColor()) fmt.Print("\n") */ }