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

profe-ajedrez / obreron / 22269206492

22 Feb 2026 02:55AM UTC coverage: 5.357% (-87.1%) from 92.476%
22269206492

push

github

areyes
Issue 2 — Sistema de errores v3: sentinels + BuildError (contrato cerrado)

6 of 107 new or added lines in 9 files covered. (5.61%)

5 existing lines in 4 files now uncovered.

6 of 112 relevant lines covered (5.36%)

0.08 hits per line

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

60.0
/errors.go
1
package obreron
2

3
import (
4
        "errors"
5
        "fmt"
6
)
7

8
// Sentinel errors returned by builders during Build/BuildInto validation.
9
//
10
// All errors are stable contract: callers may rely on errors.Is.
11
var (
12
        // Structural validation
13
        ErrEmptyFrom  = errors.New("obreron: SELECT/DELETE requires a FROM clause")
14
        ErrEmptyTable = errors.New("obreron: UPDATE/INSERT requires a target table")
15
        ErrMissingSet = errors.New("obreron: UPDATE requires at least one SET clause")
16
        ErrNoCols     = errors.New("obreron: INSERT requires at least one column")
17

18
        // Paging validation
19
        ErrInvalidLimit  = errors.New("obreron: LIMIT must be a non-negative integer")
20
        ErrInvalidOffset = errors.New("obreron: OFFSET must be a non-negative integer")
21

22
        // Placeholder / params validation
23
        ErrTooManyParams       = errors.New("obreron: too many parameters")
24
        ErrPlaceholderMismatch = errors.New("obreron: placeholder count does not match args")
25
        ErrReservedMarker      = errors.New("obreron: SQL fragment contains reserved placeholder marker byte")
26

27
        // Dialect feature gating
28
        ErrUnsupportedByDialect = errors.New("obreron: feature not supported by this dialect")
29
)
30

31
// BuildError wraps a sentinel error with additional context about where
32
// (Op) and under which dialect (Dialect) the failure occurred.
33
//
34
// It supports errors.Is / errors.As via Unwrap.
35
//
36
// Example error string:
37
//   obreron [FROM/postgres]: obreron: SELECT/DELETE requires a FROM clause
38
type BuildError struct {
39
        Op      string // e.g. "SELECT", "FROM", "WHERE", "INSERT"
40
        Dialect string // dialect name at the time of failure
41
        Err     error  // underlying sentinel error
42
}
43

44
func (e *BuildError) Error() string {
1✔
45
        if e == nil {
1✔
NEW
46
                return "obreron: <nil>"
×
NEW
47
        }
×
48
        // Keep formatting stable; callers may snapshot logs.
49
        return fmt.Sprintf("obreron [%s/%s]: %v", e.Op, e.Dialect, e.Err)
1✔
50
}
51

52
func (e *BuildError) Unwrap() error {
2✔
53
        if e == nil {
2✔
NEW
54
                return nil
×
NEW
55
        }
×
56
        return e.Err
2✔
57
}
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