func SafeFlatMapOperation(flatMapOp sif.FlatMapOperation) (safeFlatMapOp sif.FlatMapOperation) {
	return func(row sif.Row, newRow sif.RowFactory) (err error) {
		defer func() {
			if r := recover(); r != nil {
				if anErr, ok := r.(error); ok {
					err = fmt.Errorf("flatMap Panic: %w\nRow: %s\n%s", anErr, row.ToString(), GetTrace())
				} else {
					err = fmt.Errorf("flatMap Panic: %v\nRow: %s\n%s", r, row.ToString(), GetTrace())
				}
			} else if err != nil {
				err = fmt.Errorf("flatMap Error: %w\nRow: %s", err, row.ToString())
			}
		}()
		err = flatMapOp(row, newRow)
		return
	}
}
SafeFlatMapOperation wraps a FlatMapOperation such that panics are recovered and nice error messages are constructed
package util
import (
	"fmt"
	"github.com/go-sif/sif"
)
func SafeMapOperation(mapOp sif.MapOperation) (safeMapOp sif.MapOperation) {
	return func(row sif.Row) (err error) {
		defer func() {
			if r := recover(); r != nil {
				if anErr, ok := r.(error); ok {
					err = fmt.Errorf("map Panic: %w\nRow: %s\n%s", anErr, row.ToString(), GetTrace())
				} else {
					err = fmt.Errorf("map Panic: %v\nRow: %s\n%s", r, row.ToString(), GetTrace())
				}
			} else if err != nil {
				err = fmt.Errorf("map Error: %w\nRow: %s", err, row.ToString())
			}
		}()
		err = mapOp(row)
		return
	}
}
func SafeFilterOperation(filterOp sif.FilterOperation) (safeFilterOp sif.FilterOperation) {
	return func(row sif.Row) (shouldFilter bool, err error) {
		defer func() {
			if r := recover(); r != nil {
				if anErr, ok := r.(error); ok {
					err = fmt.Errorf("filter Panic: %w\nRow: %s\n%s", anErr, row.ToString(), GetTrace())
				} else {
					err = fmt.Errorf("filter Panic: %v\nRow: %s\n%s", r, row.ToString(), GetTrace())
				}
			} else if err != nil {
				err = fmt.Errorf("filter Error: %w\nRow: %s", err, row.ToString())
			}
		}()
		shouldFilter, err = filterOp(row)
		return
	}
}