data.*ErrGenerationFailed.Error   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2.1481

Importance

Changes 0
Metric Value
cc 2
eloc 4
nop 0
dl 0
loc 6
ccs 2
cts 3
cp 0.6667
crap 2.1481
rs 10
c 0
b 0
f 0
1
package data
2
3
import (
4
	"errors"
5
	"fmt"
6
)
7
8
type ErrGenerationFailed struct {
9
	GeneratorID string
10
	Message     string
11
	Path        string
12
	Previous    error
13
}
14
15
func (err *ErrGenerationFailed) Error() string {
16 1
	if err.Previous == nil {
17 1
		return fmt.Sprintf("[%s] %s", err.GeneratorID, err.Message)
18
	}
19
20
	return fmt.Sprintf("[%s] %s: %s", err.GeneratorID, err.Message, err.Previous.Error())
21
}
22
23
func (err *ErrGenerationFailed) Unwrap() error {
24
	return err.Previous
25
}
26
27
var errAttemptsLimitExceeded = errors.New("attempts limit exceeded")
28