• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

AsaiYusuke / jsonpath / 16410926563

21 Jul 2025 07:14AM UTC coverage: 17.851% (-79.5%) from 97.363%
16410926563

Pull #46

github

AsaiYusuke
refactor: move syntax and tests to internal directory

Separate directory structure from public API by relocating syntax
and test files under internal/ directory structure.
Pull Request #46: Move syntax to the internal directory and reorganize tests

181 of 406 new or added lines in 17 files covered. (44.58%)

3 existing lines in 1 file now uncovered.

676 of 3787 relevant lines covered (17.85%)

17.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/errors/errors.go
1
package errors
2

3
import "fmt"
4

5
// ErrorInvalidSyntax represents the error that have syntax error in the JSONPath.
6
type ErrorInvalidSyntax struct {
7
        Position int
8
        Reason   string
9
        Near     string
10
}
11

NEW
12
func (e ErrorInvalidSyntax) Error() string {
×
NEW
13
        return fmt.Sprintf(`invalid syntax (position=%d, reason=%s, near=%s)`, e.Position, e.Reason, e.Near)
×
NEW
14
}
×
15

NEW
16
func NewErrorInvalidSyntax(position int, reason string, near string) ErrorInvalidSyntax {
×
NEW
17
        return ErrorInvalidSyntax{
×
NEW
18
                Position: position,
×
NEW
19
                Reason:   reason,
×
NEW
20
                Near:     near,
×
NEW
21
        }
×
NEW
22
}
×
23

24
// ErrorInvalidArgument represents the error that argument specified in the JSONPath is treated as the invalid error in Go syntax.
25
type ErrorInvalidArgument struct {
26
        ArgumentName string
27
        Err          error
28
}
29

NEW
30
func (e ErrorInvalidArgument) Error() string {
×
NEW
31
        return fmt.Sprintf(`invalid argument (argument=%s, error=%s)`, e.ArgumentName, e.Err)
×
NEW
32
}
×
33

NEW
34
func NewErrorInvalidArgument(argument string, err error) ErrorInvalidArgument {
×
NEW
35
        return ErrorInvalidArgument{
×
NEW
36
                ArgumentName: argument,
×
NEW
37
                Err:          err,
×
NEW
38
        }
×
NEW
39
}
×
40

41
// ErrorNotSupported represents the error that the unsupported syntaxes specified in the JSONPath.
42
type ErrorNotSupported struct {
43
        Feature string
44
        Path    string
45
}
46

NEW
47
func (e ErrorNotSupported) Error() string {
×
NEW
48
        return fmt.Sprintf(`not supported (feature=%s, path=%s)`, e.Feature, e.Path)
×
NEW
49
}
×
50

NEW
51
func NewErrorNotSupported(feature string, path string) ErrorNotSupported {
×
NEW
52
        return ErrorNotSupported{
×
NEW
53
                Feature: feature,
×
NEW
54
                Path:    path,
×
NEW
55
        }
×
NEW
56
}
×
57

58
// ErrorFunctionNotFound represents the error that the function specified in the JSONPath is not found.
59
type ErrorFunctionNotFound struct {
60
        Function string
61
}
62

NEW
63
func (e ErrorFunctionNotFound) Error() string {
×
NEW
64
        return fmt.Sprintf(`function not found (function=%s)`, e.Function)
×
NEW
65
}
×
66

NEW
67
func NewErrorFunctionNotFound(function string) ErrorFunctionNotFound {
×
NEW
68
        return ErrorFunctionNotFound{
×
NEW
69
                Function: function,
×
NEW
70
        }
×
NEW
71
}
×
72

73
// ErrorTypeUnmatched represents the error that the node type specified in the JSONPath did not exist in the JSON object.
74
type ErrorTypeUnmatched struct {
75
        Path         string
76
        ExpectedType string
77
        FoundType    string
78
}
79

NEW
80
func (e ErrorTypeUnmatched) Error() string {
×
NEW
81
        return fmt.Sprintf(`type unmatched (expected=%s, found=%s, path=%s)`, e.ExpectedType, e.FoundType, e.Path)
×
NEW
82
}
×
83

NEW
84
func NewErrorTypeUnmatched(path string, expected string, found string) ErrorTypeUnmatched {
×
NEW
85
        return ErrorTypeUnmatched{
×
NEW
86
                Path:         path,
×
NEW
87
                ExpectedType: expected,
×
NEW
88
                FoundType:    found,
×
NEW
89
        }
×
NEW
90
}
×
91

92
// ErrorMemberNotExist represents the error that the member specified in the JSONPath did not exist in the JSON object.
93
type ErrorMemberNotExist struct {
94
        Path string
95
}
96

NEW
97
func (e ErrorMemberNotExist) Error() string {
×
NEW
98
        return fmt.Sprintf(`member did not exist (path=%s)`, e.Path)
×
NEW
99
}
×
100

NEW
101
func NewErrorMemberNotExist(path string) ErrorMemberNotExist {
×
NEW
102
        return ErrorMemberNotExist{
×
NEW
103
                Path: path,
×
NEW
104
        }
×
NEW
105
}
×
106

107
// ErrorFunctionFailed represents the error that function execution failed in the JSONPath.
108
type ErrorFunctionFailed struct {
109
        FunctionName string
110
        Err          error
111
}
112

NEW
113
func (e ErrorFunctionFailed) Error() string {
×
NEW
114
        return fmt.Sprintf(`function failed (function=%s, error=%s)`, e.FunctionName, e.Err)
×
NEW
115
}
×
116

NEW
117
func NewErrorFunctionFailed(functionName string, errorString string) ErrorFunctionFailed {
×
NEW
118
        return ErrorFunctionFailed{
×
NEW
119
                FunctionName: functionName,
×
NEW
120
                Err:          fmt.Errorf(`%s`, errorString),
×
NEW
121
        }
×
NEW
122
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc