func (e *Errors) FirstFatal() error {
	for _, err := range e.Errs {
		if err.Fatal {
			return err
		}
	}
	return nil
}
FirstFatal returns the first fatal error in e, or nil
if there is no fatal error.
package x509
import (
	"bytes"
	"fmt"
	"strconv"
	"strings"
)
type Error struct {
	ID       ErrorID
	Category ErrCategory
	Summary  string
	Field    string
	SpecRef  string
	SpecText string
	Fatal bool
}
func (err Error) Error() string {
	var msg bytes.Buffer
	if err.ID != ErrInvalidID {
		if err.Fatal {
			msg.WriteRune('E')
		} else {
			msg.WriteRune('W')
		}
		msg.WriteString(fmt.Sprintf("%03d: ", err.ID))
	}
	msg.WriteString(err.Summary)
	return msg.String()
}
func (err Error) VerboseError() string {
	var msg bytes.Buffer
	msg.WriteString(err.Error())
	if len(err.Field) > 0 || err.Category != UnknownCategory || len(err.SpecRef) > 0 || len(err.SpecText) > 0 {
		msg.WriteString(" (")
		needSep := false
		if len(err.Field) > 0 {
			msg.WriteString(err.Field)
			needSep = true
		}
		if err.Category != UnknownCategory {
			if needSep {
				msg.WriteString(": ")
			}
			msg.WriteString(err.Category.String())
			needSep = true
		}
		if len(err.SpecRef) > 0 {
			if needSep {
				msg.WriteString(": ")
			}
			msg.WriteString(err.SpecRef)
			needSep = true
		}
		if len(err.SpecText) > 0 {
			if needSep {
				if len(err.SpecRef) > 0 {
					msg.WriteString(", ")
				} else {
					msg.WriteString(": ")
				}
			}
			msg.WriteString("'")
			msg.WriteString(err.SpecText)
			msg.WriteString("'")
		}
		msg.WriteString(")")
	}
	return msg.String()
}
type ErrCategory int
const (
	UnknownCategory ErrCategory = iota
	InvalidASN1Encoding
	InvalidASN1Content
	InvalidASN1DER
	InvalidValueRange
	InvalidASN1Type
	UnexpectedAdditionalData
	PoorlyFormedCertificate  
	MalformedCertificate     
	PoorlyFormedCRL          
	MalformedCRL             
	BaselineRequirementsFailure
	EVRequirementsFailure
	InsecureAlgorithm
	UnrecognizedValue
)
func (category ErrCategory) String() string {
	switch category {
	case InvalidASN1Encoding:
		return "Invalid ASN.1 encoding"
	case InvalidASN1Content:
		return "Invalid ASN.1 content"
	case InvalidASN1DER:
		return "Invalid ASN.1 distinguished encoding"
	case InvalidValueRange:
		return "Invalid value for range given in schema"
	case InvalidASN1Type:
		return "Invalid ASN.1 type for schema"
	case UnexpectedAdditionalData:
		return "Unexpected additional data present"
	case PoorlyFormedCertificate:
		return "Certificate does not comply with SHOULD clause in spec"
	case MalformedCertificate:
		return "Certificate does not comply with MUST clause in spec"
	case PoorlyFormedCRL:
		return "Certificate Revocation List does not comply with SHOULD clause in spec"
	case MalformedCRL:
		return "Certificate Revocation List does not comply with MUST clause in spec"
	case BaselineRequirementsFailure:
		return "Certificate does not comply with CA/BF baseline requirements"
	case EVRequirementsFailure:
		return "Certificate does not comply with CA/BF EV requirements"
	case InsecureAlgorithm:
		return "Certificate uses an insecure algorithm"
	case UnrecognizedValue:
		return "Certificate uses an unrecognized value"
	default:
		return fmt.Sprintf("Unknown (%d)", category)
	}
}
type ErrorID int
type Errors struct {
	Errs []Error
}
func (e *Errors) Error() string {
	return e.combineErrors(Error.Error)
}
func (e *Errors) VerboseError() string {
	return e.combineErrors(Error.VerboseError)
}
func (e *Errors) Fatal() bool {
	return (e.FirstFatal() != nil)
}
func (e *Errors) Empty() bool {
	return len(e.Errs) == 0
}