Total Lines | 23 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | package goagi |
||
2 | |||
3 | import "fmt" |
||
4 | |||
5 | // Error object for goagi library |
||
6 | type Error struct { |
||
7 | s string |
||
8 | e string |
||
9 | } |
||
10 | |||
11 | func newError(ctx string) *Error { |
||
12 | return &Error{s: ctx} |
||
13 | } |
||
14 | |||
15 | // Msg append message to main context message |
||
16 | func (e *Error) Msg(msg string, args ...interface{}) error { |
||
17 | e.e = fmt.Sprintf(msg, args...) |
||
18 | return e |
||
19 | } |
||
20 | |||
21 | // Error message for the Error object |
||
22 | func (e *Error) Error() string { |
||
23 | return fmt.Sprintf("%s: %s", e.s, e.e) |
||
24 | } |
||
25 |