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

tarantool / go-tarantool / 14240264937

03 Apr 2025 07:53AM UTC coverage: 76.472% (+0.03%) from 76.447%
14240264937

push

github

oleg-jukovec
Release v2.3.1

3052 of 3991 relevant lines covered (76.47%)

9845.56 hits per line

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

50.0
/errors.go
1
package tarantool
2

3
import (
4
        "fmt"
5

6
        "github.com/tarantool/go-iproto"
7
)
8

9
// Error is wrapper around error returned by Tarantool.
10
type Error struct {
11
        Code         iproto.Error
12
        Msg          string
13
        ExtendedInfo *BoxError
14
}
15

16
// Error converts an Error to a string.
17
func (tnterr Error) Error() string {
4✔
18
        if tnterr.ExtendedInfo != nil {
8✔
19
                return tnterr.ExtendedInfo.Error()
4✔
20
        }
4✔
21

22
        return fmt.Sprintf("%s (0x%x)", tnterr.Msg, tnterr.Code)
×
23
}
24

25
// ClientError is connection error produced by this client,
26
// i.e. connection failures or timeouts.
27
type ClientError struct {
28
        Code uint32
29
        Msg  string
30
}
31

32
// Error converts a ClientError to a string.
33
func (clierr ClientError) Error() string {
8✔
34
        return fmt.Sprintf("%s (0x%x)", clierr.Msg, clierr.Code)
8✔
35
}
8✔
36

37
// Temporary returns true if next attempt to perform request may succeeded.
38
//
39
// Currently it returns true when:
40
//
41
// - Connection is not connected at the moment
42
//
43
// - request is timeouted
44
//
45
// - request is aborted due to rate limit
46
func (clierr ClientError) Temporary() bool {
×
47
        switch clierr.Code {
×
48
        case ErrConnectionNotReady, ErrTimeouted, ErrRateLimited, ErrIoError:
×
49
                return true
×
50
        default:
×
51
                return false
×
52
        }
53
}
54

55
// Tarantool client error codes.
56
const (
57
        ErrConnectionNotReady = 0x4000 + iota
58
        ErrConnectionClosed   = 0x4000 + iota
59
        ErrProtocolError      = 0x4000 + iota
60
        ErrTimeouted          = 0x4000 + iota
61
        ErrRateLimited        = 0x4000 + iota
62
        ErrConnectionShutdown = 0x4000 + iota
63
        ErrIoError            = 0x4000 + iota
64
)
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