-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherrors.go
More file actions
38 lines (31 loc) · 826 Bytes
/
errors.go
File metadata and controls
38 lines (31 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package extcap
import (
"errors"
"fmt"
"runtime"
)
var (
// ErrNoInterfaceSpecified is returned when start capture or query configuration options or query supported DLTs
ErrNoInterfaceSpecified = errors.New("No interface specified")
// ErrNoPipeProvided is returned when start capture and not provide pipe name to write
ErrNoPipeProvided = errors.New("No FIFO pipe provided")
// Invalid name of interface
ErrInvalidInterface = errors.New("Invalid interface")
)
type Error struct {
file string
line int
message string
err error
}
func (err *Error) Error() string {
return fmt.Sprintf("%s:%d -- %s: %s", err.file, err.line, err.message, err.err)
}
func NewError(msg string, err error) *Error {
e := &Error{
message: msg,
err: err,
}
_, e.file, e.line, _ = runtime.Caller(1)
return e
}