error.go   A
last analyzed

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 12
dl 0
loc 23
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A goagi.newError 0 2 1
A goagi.*Error.Msg 0 3 1
A goagi.*Error.Error 0 2 1
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