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

mendersoftware / mender-server / 1902703503

02 Jul 2025 02:55PM UTC coverage: 65.459%. First build
1902703503

Pull #784

gitlab-ci

bahaa-ghazal
chore: Remove github.com/ant0ine/go-json-rest package from the backend

Ticket: MEN-8233
Signed-off-by: Bahaa Aldeen Ghazal <bahaa.ghazal@northern.tech>
Pull Request #784: refactor: Remove github.com/ant0ine/go-json-rest from the backend

52 of 72 new or added lines in 13 files covered. (72.22%)

31902 of 48736 relevant lines covered (65.46%)

1.39 hits per line

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

20.0
/backend/pkg/rest.utils/error.go
1
// Copyright 2023 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14

15
package rest
16

17
import (
18
        "encoding/json"
19
        "io"
20
)
21

22
type Error struct {
23
        Err       string `json:"error"`
24
        RequestID string `json:"request_id,omitempty"`
25
}
26

27
func (err Error) Error() string {
1✔
28
        return err.Err
1✔
29
}
1✔
30

NEW
31
func IsApiError(e error) bool {
×
NEW
32
        _, ok := e.(*Error)
×
NEW
33
        return ok
×
NEW
34
}
×
35

NEW
36
func ParseApiError(source io.Reader) error {
×
NEW
37
        jd := json.NewDecoder(source)
×
NEW
38

×
NEW
39
        var aerr Error
×
NEW
40
        if err := jd.Decode(&aerr); err != nil {
×
NEW
41
                return err
×
NEW
42
        }
×
43

NEW
44
        return &aerr
×
45
}
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

© 2025 Coveralls, Inc