-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherrors.go
More file actions
37 lines (30 loc) · 1.16 KB
/
errors.go
File metadata and controls
37 lines (30 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//go:build goexperiment.simd && amd64
package simdcsv
import (
"errors"
"fmt"
)
// Sentinel errors returned by [Reader]. These are compatible with [encoding/csv].
var (
ErrBareQuote = errors.New("bare \" in non-quoted-field")
ErrQuote = errors.New("extraneous or missing \" in quoted-field")
ErrFieldCount = errors.New("wrong number of fields")
ErrInputTooLarge = errors.New("input exceeds maximum allowed size")
)
// DefaultMaxInputSize is the default maximum input size (2GB).
const DefaultMaxInputSize = 2 * 1024 * 1024 * 1024
// ParseError represents a parsing error with location information.
type ParseError struct {
StartLine int // Line where the record started
Line int // Line where the error occurred
Column int // Column where the error occurred (1-indexed)
Err error // Underlying error
}
// Error returns a formatted error message with location information.
func (e *ParseError) Error() string {
return fmt.Sprintf("parse error on line %d, column %d: %v", e.Line, e.Column, e.Err)
}
// Unwrap returns the underlying error for use with [errors.Is] and [errors.As].
func (e *ParseError) Unwrap() error {
return e.Err
}