error_types

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 10 Imported by: 7 modules, 10 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RowError

type RowError interface {
	error
	GetSource() string
	GetOperation() RowOperationType
	// contains filtered or unexported methods
}

RowError is an interface for errors that occur during row processing (mapping, enrichment, validation).

func EnsureRowError

func EnsureRowError(source string, operation RowOperationType, err error) RowError

EnsureRowError ensures that the error is a RowError, if not it converts it to a RowErrorWithMessage

type RowErrorWithFields

type RowErrorWithFields struct {
	Source        string           `json:"source"`
	Operation     RowOperationType `json:"operation"`
	MissingFields []string         `json:"missing_fields,omitempty"`
	InvalidFields []string         `json:"invalid_fields,omitempty"`
}

RowErrorWithFields is an implementation of RowError that includes missing and invalid fields. It is used to represent errors that are caused by specific fields either missing or invalid in the row.

func NewRowErrorWithFields

func NewRowErrorWithFields(missingFields, invalidFields []string) *RowErrorWithFields

func (*RowErrorWithFields) Error

func (r *RowErrorWithFields) Error() string

func (*RowErrorWithFields) GetOperation

func (r *RowErrorWithFields) GetOperation() RowOperationType

func (*RowErrorWithFields) GetSource

func (r *RowErrorWithFields) GetSource() string

type RowErrorWithMessage

type RowErrorWithMessage struct {
	Source    string           `json:"source"`
	Operation RowOperationType `json:"operation"`
	Message   string           `json:"message"`
}

RowErrorWithMessage is an implementation of RowError that includes a message. It is used to represent row errors where an error is not related to specific fields allowing for a descriptive message to be used instead. Also used as a generic fallback by EnsureRowError if the error is not a RowError.

func NewRowErrorWithMessage

func NewRowErrorWithMessage(message string) *RowErrorWithMessage

func (*RowErrorWithMessage) Error

func (r *RowErrorWithMessage) Error() string

func (*RowErrorWithMessage) GetOperation

func (r *RowErrorWithMessage) GetOperation() RowOperationType

func (*RowErrorWithMessage) GetSource

func (r *RowErrorWithMessage) GetSource() string

type RowErrors

type RowErrors struct {
	Total int64
	// contains filtered or unexported fields
}

RowErrors is an aggregation of row errors, grouping by RowOperationType and error message

func NewRowErrors

func NewRowErrors() *RowErrors

NewRowErrors creates a new RowErrors correctly, should always be used to create a new RowErrors

func RowErrorsFromProto

func RowErrorsFromProto(proto *proto.RowErrors) *RowErrors

RowErrorsFromProto converts a protobuf representation to a RowErrors

func (*RowErrors) Add

func (r *RowErrors) Add(err RowError)

Add adds a RowError to the RowErrors

func (*RowErrors) Errors

func (r *RowErrors) Errors() []string

Errors returns one row per source, with a summary of the errors e.g. "source: 100 rows failed mapping with 2 missing fields: field1, field2" or "source: 100 rows failed with 2 errors" if there are multiple error messages which are not related to missing/invalid fields or "source: 100 rows failed with error: message" if there is only one error message for the source

func (*RowErrors) ToProto

func (r *RowErrors) ToProto() *proto.RowErrors

ToProto converts the RowErrors to a protobuf representation

type RowOperationType

type RowOperationType string
const (
	RowOperationTypeMapping    RowOperationType = "mapping"
	RowOperationTypeEnrichment RowOperationType = "enrichment"
	RowOperationTypeValidation RowOperationType = "validation"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL