data.*ErrGenerationFailed.Unwrap   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 0
dl 0
loc 2
ccs 0
cts 1
cp 0
crap 2
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