ErrorHandler.go   A
last analyzed

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 14
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A main.*ErrorHandler.setNext 0 3 1
A main.*ErrorHandler.execute 0 9 3
1
/**
2
 * @author  : Jagepard <[email protected]>
3
 * @license https://mit-license.org/ MIT
4
 */
5
6
package main
7
8
import "fmt"
9
10
// ErrorHandler is ...
11
type ErrorHandler struct {
12
	name string
13
	next HandlerInterface
14
}
15
16
func (E *ErrorHandler) execute(request string) {
17
18
	if request == E.name {
19
		fmt.Println(E.name)
20
		return
21
	}
22
23
	if E.next != nil {
24
		E.next.execute(request)
25
	}
26
}
27
28
func (E *ErrorHandler) setNext(next HandlerInterface) HandlerInterface {
29
	E.next = next
30
	return next
31
}
32