tavern/errors/errors_generated.go

1465 lines
29 KiB
Go

// Code generated by go generate; DO NOT EDIT.
// This file was generated by herr at 2020-02-25 12:24:47.399517871 -0500 EST m=+0.008318680
package errors
import (
"fmt"
"io"
"path"
"runtime"
"strconv"
"strings"
go_errors "errors"
)
type CodedError interface {
Code() int
Description() string
Prefix() string
error
}
type NotFoundError struct {
Err error
Stack *stack
}
type EncryptFailedError struct {
Err error
Stack *stack
}
type DecryptFailedError struct {
Err error
Stack *stack
}
type QueryFailedError struct {
Err error
Stack *stack
}
type DatabaseTransactionFailedError struct {
Err error
Stack *stack
}
type InsertQueryFailedError struct {
Err error
Stack *stack
}
type SelectQueryFailedError struct {
Err error
Stack *stack
}
type UpdateQueryFailedError struct {
Err error
Stack *stack
}
type InvalidUserIDError struct {
Err error
Stack *stack
}
type UserNotFoundError struct {
Err error
Stack *stack
}
type CreateUserFailedError struct {
Err error
Stack *stack
}
type UserQueryFailedError struct {
Err error
Stack *stack
}
type UpdateUserFailedError struct {
Err error
Stack *stack
}
type UserSessionNotFoundError struct {
Err error
Stack *stack
}
type InvalidEmailVerificationError struct {
Err error
Stack *stack
}
type CannotSaveSessionError struct {
Err error
Stack *stack
}
type InvalidCaptchaError struct {
Err error
Stack *stack
}
type EmailSendFailedError struct {
Err error
Stack *stack
}
var _ CodedError = NotFoundError{}
var _ CodedError = EncryptFailedError{}
var _ CodedError = DecryptFailedError{}
var _ CodedError = QueryFailedError{}
var _ CodedError = DatabaseTransactionFailedError{}
var _ CodedError = InsertQueryFailedError{}
var _ CodedError = SelectQueryFailedError{}
var _ CodedError = UpdateQueryFailedError{}
var _ CodedError = InvalidUserIDError{}
var _ CodedError = UserNotFoundError{}
var _ CodedError = CreateUserFailedError{}
var _ CodedError = UserQueryFailedError{}
var _ CodedError = UpdateUserFailedError{}
var _ CodedError = UserSessionNotFoundError{}
var _ CodedError = InvalidEmailVerificationError{}
var _ CodedError = CannotSaveSessionError{}
var _ CodedError = InvalidCaptchaError{}
var _ CodedError = EmailSendFailedError{}
// ErrorFromCode returns the CodedError for a serialized coded error string.
func ErrorFromCode(code string) (bool, error) {
switch code {
case "TAVAAAAAAAB":
return true, NotFoundError{}
case "TAVAAAAAAAC":
return true, EncryptFailedError{}
case "TAVAAAAAAAD":
return true, DecryptFailedError{}
case "TAVDATAAAAAAAB":
return true, QueryFailedError{}
case "TAVDATAAAAAAAC":
return true, DatabaseTransactionFailedError{}
case "TAVDATAAAAAAAD":
return true, InsertQueryFailedError{}
case "TAVDATAAAAAAAE":
return true, SelectQueryFailedError{}
case "TAVDATAAAAAAAF":
return true, UpdateQueryFailedError{}
case "TAVDATAAAAAAAG":
return true, InvalidUserIDError{}
case "TAVDATAAAAAAAH":
return true, UserNotFoundError{}
case "TAVDATAAAAAAAI":
return true, CreateUserFailedError{}
case "TAVDATAAAAAAAJ":
return true, UserQueryFailedError{}
case "TAVDATAAAAAAAK":
return true, UpdateUserFailedError{}
case "TAVDATAAAAAAAL":
return true, UserSessionNotFoundError{}
case "TAVWEBAAAAAAAB":
return true, InvalidEmailVerificationError{}
case "TAVWEBAAAAAAAC":
return true, CannotSaveSessionError{}
case "TAVWEBAAAAAAAD":
return true, InvalidCaptchaError{}
case "TAVWEBAAAAAAAE":
return true, EmailSendFailedError{}
default:
return false, fmt.Errorf("unknown error code: %s", code)
}
}
func NewNotFoundError(err error) error {
return NotFoundError{ Err: err, Stack: callers() }
}
func WrapNotFoundError(err error) error {
if err == nil {
return nil
}
return NewNotFoundError(err)
}
func NewEncryptFailedError(err error) error {
return EncryptFailedError{ Err: err, Stack: callers() }
}
func WrapEncryptFailedError(err error) error {
if err == nil {
return nil
}
return NewEncryptFailedError(err)
}
func NewDecryptFailedError(err error) error {
return DecryptFailedError{ Err: err, Stack: callers() }
}
func WrapDecryptFailedError(err error) error {
if err == nil {
return nil
}
return NewDecryptFailedError(err)
}
func NewQueryFailedError(err error) error {
return QueryFailedError{ Err: err, Stack: callers() }
}
func WrapQueryFailedError(err error) error {
if err == nil {
return nil
}
return NewQueryFailedError(err)
}
func NewDatabaseTransactionFailedError(err error) error {
return DatabaseTransactionFailedError{ Err: err, Stack: callers() }
}
func WrapDatabaseTransactionFailedError(err error) error {
if err == nil {
return nil
}
return NewDatabaseTransactionFailedError(err)
}
func NewInsertQueryFailedError(err error) error {
return InsertQueryFailedError{ Err: err, Stack: callers() }
}
func WrapInsertQueryFailedError(err error) error {
if err == nil {
return nil
}
return NewInsertQueryFailedError(err)
}
func NewSelectQueryFailedError(err error) error {
return SelectQueryFailedError{ Err: err, Stack: callers() }
}
func WrapSelectQueryFailedError(err error) error {
if err == nil {
return nil
}
return NewSelectQueryFailedError(err)
}
func NewUpdateQueryFailedError(err error) error {
return UpdateQueryFailedError{ Err: err, Stack: callers() }
}
func WrapUpdateQueryFailedError(err error) error {
if err == nil {
return nil
}
return NewUpdateQueryFailedError(err)
}
func NewInvalidUserIDError(err error) error {
return InvalidUserIDError{ Err: err, Stack: callers() }
}
func WrapInvalidUserIDError(err error) error {
if err == nil {
return nil
}
return NewInvalidUserIDError(err)
}
func NewUserNotFoundError(err error) error {
return UserNotFoundError{ Err: err, Stack: callers() }
}
func WrapUserNotFoundError(err error) error {
if err == nil {
return nil
}
return NewUserNotFoundError(err)
}
func NewCreateUserFailedError(err error) error {
return CreateUserFailedError{ Err: err, Stack: callers() }
}
func WrapCreateUserFailedError(err error) error {
if err == nil {
return nil
}
return NewCreateUserFailedError(err)
}
func NewUserQueryFailedError(err error) error {
return UserQueryFailedError{ Err: err, Stack: callers() }
}
func WrapUserQueryFailedError(err error) error {
if err == nil {
return nil
}
return NewUserQueryFailedError(err)
}
func NewUpdateUserFailedError(err error) error {
return UpdateUserFailedError{ Err: err, Stack: callers() }
}
func WrapUpdateUserFailedError(err error) error {
if err == nil {
return nil
}
return NewUpdateUserFailedError(err)
}
func NewUserSessionNotFoundError(err error) error {
return UserSessionNotFoundError{ Err: err, Stack: callers() }
}
func WrapUserSessionNotFoundError(err error) error {
if err == nil {
return nil
}
return NewUserSessionNotFoundError(err)
}
func NewInvalidEmailVerificationError(err error) error {
return InvalidEmailVerificationError{ Err: err, Stack: callers() }
}
func WrapInvalidEmailVerificationError(err error) error {
if err == nil {
return nil
}
return NewInvalidEmailVerificationError(err)
}
func NewCannotSaveSessionError(err error) error {
return CannotSaveSessionError{ Err: err, Stack: callers() }
}
func WrapCannotSaveSessionError(err error) error {
if err == nil {
return nil
}
return NewCannotSaveSessionError(err)
}
func NewInvalidCaptchaError(err error) error {
return InvalidCaptchaError{ Err: err, Stack: callers() }
}
func WrapInvalidCaptchaError(err error) error {
if err == nil {
return nil
}
return NewInvalidCaptchaError(err)
}
func NewEmailSendFailedError(err error) error {
return EmailSendFailedError{ Err: err, Stack: callers() }
}
func WrapEmailSendFailedError(err error) error {
if err == nil {
return nil
}
return NewEmailSendFailedError(err)
}
func (e NotFoundError) Error() string {
return "TAVAAAAAAAB"
}
func (e NotFoundError) Unwrap() error {
return e.Err
}
func (e NotFoundError) Is(target error) bool {
t, ok := target.(NotFoundError)
if !ok {
return false
}
return t.Prefix() == "TAV" && t.Code() == 1
}
func (e NotFoundError) Code() int {
return 1
}
func (e NotFoundError) Description() string {
return "Not found."
}
func (e NotFoundError) Prefix() string {
return "TAV"
}
func (e NotFoundError) String() string {
return "TAVAAAAAAAB Not found."
}
func (e NotFoundError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVAAAAAAAB")
case 'q':
fmt.Fprintf(s, "%q", "TAVAAAAAAAB")
}
}
func (e EncryptFailedError) Error() string {
return "TAVAAAAAAAC"
}
func (e EncryptFailedError) Unwrap() error {
return e.Err
}
func (e EncryptFailedError) Is(target error) bool {
t, ok := target.(EncryptFailedError)
if !ok {
return false
}
return t.Prefix() == "TAV" && t.Code() == 2
}
func (e EncryptFailedError) Code() int {
return 2
}
func (e EncryptFailedError) Description() string {
return "Encrypting data failed."
}
func (e EncryptFailedError) Prefix() string {
return "TAV"
}
func (e EncryptFailedError) String() string {
return "TAVAAAAAAAC Encrypting data failed."
}
func (e EncryptFailedError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVAAAAAAAC")
case 'q':
fmt.Fprintf(s, "%q", "TAVAAAAAAAC")
}
}
func (e DecryptFailedError) Error() string {
return "TAVAAAAAAAD"
}
func (e DecryptFailedError) Unwrap() error {
return e.Err
}
func (e DecryptFailedError) Is(target error) bool {
t, ok := target.(DecryptFailedError)
if !ok {
return false
}
return t.Prefix() == "TAV" && t.Code() == 3
}
func (e DecryptFailedError) Code() int {
return 3
}
func (e DecryptFailedError) Description() string {
return "Decrypting data failed."
}
func (e DecryptFailedError) Prefix() string {
return "TAV"
}
func (e DecryptFailedError) String() string {
return "TAVAAAAAAAD Decrypting data failed."
}
func (e DecryptFailedError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVAAAAAAAD")
case 'q':
fmt.Fprintf(s, "%q", "TAVAAAAAAAD")
}
}
func (e QueryFailedError) Error() string {
return "TAVDATAAAAAAAB"
}
func (e QueryFailedError) Unwrap() error {
return e.Err
}
func (e QueryFailedError) Is(target error) bool {
t, ok := target.(QueryFailedError)
if !ok {
return false
}
return t.Prefix() == "TAVDAT" && t.Code() == 1
}
func (e QueryFailedError) Code() int {
return 1
}
func (e QueryFailedError) Description() string {
return "The query operation failed."
}
func (e QueryFailedError) Prefix() string {
return "TAVDAT"
}
func (e QueryFailedError) String() string {
return "TAVDATAAAAAAAB The query operation failed."
}
func (e QueryFailedError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVDATAAAAAAAB")
case 'q':
fmt.Fprintf(s, "%q", "TAVDATAAAAAAAB")
}
}
func (e DatabaseTransactionFailedError) Error() string {
return "TAVDATAAAAAAAC"
}
func (e DatabaseTransactionFailedError) Unwrap() error {
return e.Err
}
func (e DatabaseTransactionFailedError) Is(target error) bool {
t, ok := target.(DatabaseTransactionFailedError)
if !ok {
return false
}
return t.Prefix() == "TAVDAT" && t.Code() == 2
}
func (e DatabaseTransactionFailedError) Code() int {
return 2
}
func (e DatabaseTransactionFailedError) Description() string {
return "The database transaction failed."
}
func (e DatabaseTransactionFailedError) Prefix() string {
return "TAVDAT"
}
func (e DatabaseTransactionFailedError) String() string {
return "TAVDATAAAAAAAC The database transaction failed."
}
func (e DatabaseTransactionFailedError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVDATAAAAAAAC")
case 'q':
fmt.Fprintf(s, "%q", "TAVDATAAAAAAAC")
}
}
func (e InsertQueryFailedError) Error() string {
return "TAVDATAAAAAAAD"
}
func (e InsertQueryFailedError) Unwrap() error {
return e.Err
}
func (e InsertQueryFailedError) Is(target error) bool {
t, ok := target.(InsertQueryFailedError)
if !ok {
return false
}
return t.Prefix() == "TAVDAT" && t.Code() == 3
}
func (e InsertQueryFailedError) Code() int {
return 3
}
func (e InsertQueryFailedError) Description() string {
return "The insert query failed"
}
func (e InsertQueryFailedError) Prefix() string {
return "TAVDAT"
}
func (e InsertQueryFailedError) String() string {
return "TAVDATAAAAAAAD The insert query failed"
}
func (e InsertQueryFailedError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVDATAAAAAAAD")
case 'q':
fmt.Fprintf(s, "%q", "TAVDATAAAAAAAD")
}
}
func (e SelectQueryFailedError) Error() string {
return "TAVDATAAAAAAAE"
}
func (e SelectQueryFailedError) Unwrap() error {
return e.Err
}
func (e SelectQueryFailedError) Is(target error) bool {
t, ok := target.(SelectQueryFailedError)
if !ok {
return false
}
return t.Prefix() == "TAVDAT" && t.Code() == 4
}
func (e SelectQueryFailedError) Code() int {
return 4
}
func (e SelectQueryFailedError) Description() string {
return "The select query failed"
}
func (e SelectQueryFailedError) Prefix() string {
return "TAVDAT"
}
func (e SelectQueryFailedError) String() string {
return "TAVDATAAAAAAAE The select query failed"
}
func (e SelectQueryFailedError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVDATAAAAAAAE")
case 'q':
fmt.Fprintf(s, "%q", "TAVDATAAAAAAAE")
}
}
func (e UpdateQueryFailedError) Error() string {
return "TAVDATAAAAAAAF"
}
func (e UpdateQueryFailedError) Unwrap() error {
return e.Err
}
func (e UpdateQueryFailedError) Is(target error) bool {
t, ok := target.(UpdateQueryFailedError)
if !ok {
return false
}
return t.Prefix() == "TAVDAT" && t.Code() == 5
}
func (e UpdateQueryFailedError) Code() int {
return 5
}
func (e UpdateQueryFailedError) Description() string {
return "The update query failed"
}
func (e UpdateQueryFailedError) Prefix() string {
return "TAVDAT"
}
func (e UpdateQueryFailedError) String() string {
return "TAVDATAAAAAAAF The update query failed"
}
func (e UpdateQueryFailedError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVDATAAAAAAAF")
case 'q':
fmt.Fprintf(s, "%q", "TAVDATAAAAAAAF")
}
}
func (e InvalidUserIDError) Error() string {
return "TAVDATAAAAAAAG"
}
func (e InvalidUserIDError) Unwrap() error {
return e.Err
}
func (e InvalidUserIDError) Is(target error) bool {
t, ok := target.(InvalidUserIDError)
if !ok {
return false
}
return t.Prefix() == "TAVDAT" && t.Code() == 6
}
func (e InvalidUserIDError) Code() int {
return 6
}
func (e InvalidUserIDError) Description() string {
return "The user ID is invalid."
}
func (e InvalidUserIDError) Prefix() string {
return "TAVDAT"
}
func (e InvalidUserIDError) String() string {
return "TAVDATAAAAAAAG The user ID is invalid."
}
func (e InvalidUserIDError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVDATAAAAAAAG")
case 'q':
fmt.Fprintf(s, "%q", "TAVDATAAAAAAAG")
}
}
func (e UserNotFoundError) Error() string {
return "TAVDATAAAAAAAH"
}
func (e UserNotFoundError) Unwrap() error {
return e.Err
}
func (e UserNotFoundError) Is(target error) bool {
t, ok := target.(UserNotFoundError)
if !ok {
return false
}
return t.Prefix() == "TAVDAT" && t.Code() == 7
}
func (e UserNotFoundError) Code() int {
return 7
}
func (e UserNotFoundError) Description() string {
return "The user was not found."
}
func (e UserNotFoundError) Prefix() string {
return "TAVDAT"
}
func (e UserNotFoundError) String() string {
return "TAVDATAAAAAAAH The user was not found."
}
func (e UserNotFoundError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVDATAAAAAAAH")
case 'q':
fmt.Fprintf(s, "%q", "TAVDATAAAAAAAH")
}
}
func (e CreateUserFailedError) Error() string {
return "TAVDATAAAAAAAI"
}
func (e CreateUserFailedError) Unwrap() error {
return e.Err
}
func (e CreateUserFailedError) Is(target error) bool {
t, ok := target.(CreateUserFailedError)
if !ok {
return false
}
return t.Prefix() == "TAVDAT" && t.Code() == 8
}
func (e CreateUserFailedError) Code() int {
return 8
}
func (e CreateUserFailedError) Description() string {
return "The user was not able to be created."
}
func (e CreateUserFailedError) Prefix() string {
return "TAVDAT"
}
func (e CreateUserFailedError) String() string {
return "TAVDATAAAAAAAI The user was not able to be created."
}
func (e CreateUserFailedError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVDATAAAAAAAI")
case 'q':
fmt.Fprintf(s, "%q", "TAVDATAAAAAAAI")
}
}
func (e UserQueryFailedError) Error() string {
return "TAVDATAAAAAAAJ"
}
func (e UserQueryFailedError) Unwrap() error {
return e.Err
}
func (e UserQueryFailedError) Is(target error) bool {
t, ok := target.(UserQueryFailedError)
if !ok {
return false
}
return t.Prefix() == "TAVDAT" && t.Code() == 9
}
func (e UserQueryFailedError) Code() int {
return 9
}
func (e UserQueryFailedError) Description() string {
return "The user query failed."
}
func (e UserQueryFailedError) Prefix() string {
return "TAVDAT"
}
func (e UserQueryFailedError) String() string {
return "TAVDATAAAAAAAJ The user query failed."
}
func (e UserQueryFailedError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVDATAAAAAAAJ")
case 'q':
fmt.Fprintf(s, "%q", "TAVDATAAAAAAAJ")
}
}
func (e UpdateUserFailedError) Error() string {
return "TAVDATAAAAAAAK"
}
func (e UpdateUserFailedError) Unwrap() error {
return e.Err
}
func (e UpdateUserFailedError) Is(target error) bool {
t, ok := target.(UpdateUserFailedError)
if !ok {
return false
}
return t.Prefix() == "TAVDAT" && t.Code() == 10
}
func (e UpdateUserFailedError) Code() int {
return 10
}
func (e UpdateUserFailedError) Description() string {
return "The user was not able to be updated."
}
func (e UpdateUserFailedError) Prefix() string {
return "TAVDAT"
}
func (e UpdateUserFailedError) String() string {
return "TAVDATAAAAAAAK The user was not able to be updated."
}
func (e UpdateUserFailedError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVDATAAAAAAAK")
case 'q':
fmt.Fprintf(s, "%q", "TAVDATAAAAAAAK")
}
}
func (e UserSessionNotFoundError) Error() string {
return "TAVDATAAAAAAAL"
}
func (e UserSessionNotFoundError) Unwrap() error {
return e.Err
}
func (e UserSessionNotFoundError) Is(target error) bool {
t, ok := target.(UserSessionNotFoundError)
if !ok {
return false
}
return t.Prefix() == "TAVDAT" && t.Code() == 11
}
func (e UserSessionNotFoundError) Code() int {
return 11
}
func (e UserSessionNotFoundError) Description() string {
return "The user session was not found."
}
func (e UserSessionNotFoundError) Prefix() string {
return "TAVDAT"
}
func (e UserSessionNotFoundError) String() string {
return "TAVDATAAAAAAAL The user session was not found."
}
func (e UserSessionNotFoundError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVDATAAAAAAAL")
case 'q':
fmt.Fprintf(s, "%q", "TAVDATAAAAAAAL")
}
}
func (e InvalidEmailVerificationError) Error() string {
return "TAVWEBAAAAAAAB"
}
func (e InvalidEmailVerificationError) Unwrap() error {
return e.Err
}
func (e InvalidEmailVerificationError) Is(target error) bool {
t, ok := target.(InvalidEmailVerificationError)
if !ok {
return false
}
return t.Prefix() == "TAVWEB" && t.Code() == 1
}
func (e InvalidEmailVerificationError) Code() int {
return 1
}
func (e InvalidEmailVerificationError) Description() string {
return "Invalid verification."
}
func (e InvalidEmailVerificationError) Prefix() string {
return "TAVWEB"
}
func (e InvalidEmailVerificationError) String() string {
return "TAVWEBAAAAAAAB Invalid verification."
}
func (e InvalidEmailVerificationError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVWEBAAAAAAAB")
case 'q':
fmt.Fprintf(s, "%q", "TAVWEBAAAAAAAB")
}
}
func (e CannotSaveSessionError) Error() string {
return "TAVWEBAAAAAAAC"
}
func (e CannotSaveSessionError) Unwrap() error {
return e.Err
}
func (e CannotSaveSessionError) Is(target error) bool {
t, ok := target.(CannotSaveSessionError)
if !ok {
return false
}
return t.Prefix() == "TAVWEB" && t.Code() == 2
}
func (e CannotSaveSessionError) Code() int {
return 2
}
func (e CannotSaveSessionError) Description() string {
return "Cannot save session."
}
func (e CannotSaveSessionError) Prefix() string {
return "TAVWEB"
}
func (e CannotSaveSessionError) String() string {
return "TAVWEBAAAAAAAC Cannot save session."
}
func (e CannotSaveSessionError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVWEBAAAAAAAC")
case 'q':
fmt.Fprintf(s, "%q", "TAVWEBAAAAAAAC")
}
}
func (e InvalidCaptchaError) Error() string {
return "TAVWEBAAAAAAAD"
}
func (e InvalidCaptchaError) Unwrap() error {
return e.Err
}
func (e InvalidCaptchaError) Is(target error) bool {
t, ok := target.(InvalidCaptchaError)
if !ok {
return false
}
return t.Prefix() == "TAVWEB" && t.Code() == 3
}
func (e InvalidCaptchaError) Code() int {
return 3
}
func (e InvalidCaptchaError) Description() string {
return "Invalid captcha."
}
func (e InvalidCaptchaError) Prefix() string {
return "TAVWEB"
}
func (e InvalidCaptchaError) String() string {
return "TAVWEBAAAAAAAD Invalid captcha."
}
func (e InvalidCaptchaError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVWEBAAAAAAAD")
case 'q':
fmt.Fprintf(s, "%q", "TAVWEBAAAAAAAD")
}
}
func (e EmailSendFailedError) Error() string {
return "TAVWEBAAAAAAAE"
}
func (e EmailSendFailedError) Unwrap() error {
return e.Err
}
func (e EmailSendFailedError) Is(target error) bool {
t, ok := target.(EmailSendFailedError)
if !ok {
return false
}
return t.Prefix() == "TAVWEB" && t.Code() == 4
}
func (e EmailSendFailedError) Code() int {
return 4
}
func (e EmailSendFailedError) Description() string {
return "Unable to send email."
}
func (e EmailSendFailedError) Prefix() string {
return "TAVWEB"
}
func (e EmailSendFailedError) String() string {
return "TAVWEBAAAAAAAE Unable to send email."
}
func (e EmailSendFailedError) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", e.Unwrap())
e.Stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, "TAVWEBAAAAAAAE")
case 'q':
fmt.Fprintf(s, "%q", "TAVWEBAAAAAAAE")
}
}
// Frame represents a program counter inside a stack frame.
// For historical reasons if Frame is interpreted as a uintptr
// its value represents the program counter + 1.
type Frame uintptr
// pc returns the program counter for this frame;
// multiple frames may have the same PC value.
func (f Frame) pc() uintptr { return uintptr(f) - 1 }
// file returns the full path to the file that contains the
// function for this Frame's pc.
func (f Frame) file() string {
fn := runtime.FuncForPC(f.pc())
if fn == nil {
return "unknown"
}
file, _ := fn.FileLine(f.pc())
return file
}
// line returns the line number of source code of the
// function for this Frame's pc.
func (f Frame) line() int {
fn := runtime.FuncForPC(f.pc())
if fn == nil {
return 0
}
_, line := fn.FileLine(f.pc())
return line
}
// name returns the name of this function, if known.
func (f Frame) name() string {
fn := runtime.FuncForPC(f.pc())
if fn == nil {
return "unknown"
}
return fn.Name()
}
// Format formats the frame according to the fmt.Formatter interface.
//
// %s source file
// %d source line
// %n function name
// %v equivalent to %s:%d
//
// Format accepts flags that alter the printing of some verbs, as follows:
//
// %+s function name and path of source file relative to the compile time
// GOPATH separated by \n\t (<funcname>\n\t<path>)
// %+v equivalent to %+s:%d
func (f Frame) Format(s fmt.State, verb rune) {
switch verb {
case 's':
switch {
case s.Flag('+'):
io.WriteString(s, f.name())
io.WriteString(s, "\n\t")
io.WriteString(s, f.file())
default:
io.WriteString(s, path.Base(f.file()))
}
case 'd':
io.WriteString(s, strconv.Itoa(f.line()))
case 'n':
io.WriteString(s, funcname(f.name()))
case 'v':
f.Format(s, 's')
io.WriteString(s, ":")
f.Format(s, 'd')
}
}
// MarshalText formats a stacktrace Frame as a text string. The output is the
// same as that of fmt.Sprintf("%+v", f), but without newlines or tabs.
func (f Frame) MarshalText() ([]byte, error) {
name := f.name()
if name == "unknown" {
return []byte(name), nil
}
return []byte(fmt.Sprintf("%s %s:%d", name, f.file(), f.line())), nil
}
// StackTrace is stack of Frames from innermost (newest) to outermost (oldest).
type StackTrace []Frame
// Format formats the stack of Frames according to the fmt.Formatter interface.
//
// %s lists source files for each Frame in the stack
// %v lists the source file and line number for each Frame in the stack
//
// Format accepts flags that alter the printing of some verbs, as follows:
//
// %+v Prints filename, function, and line number for each Frame in the stack.
func (st StackTrace) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
switch {
case s.Flag('+'):
for _, f := range st {
io.WriteString(s, "\n")
f.Format(s, verb)
}
case s.Flag('#'):
fmt.Fprintf(s, "%#v", []Frame(st))
default:
st.formatSlice(s, verb)
}
case 's':
st.formatSlice(s, verb)
}
}
// formatSlice will format this StackTrace into the given buffer as a slice of
// Frame, only valid when called with '%s' or '%v'.
func (st StackTrace) formatSlice(s fmt.State, verb rune) {
io.WriteString(s, "[")
for i, f := range st {
if i > 0 {
io.WriteString(s, " ")
}
f.Format(s, verb)
}
io.WriteString(s, "]")
}
// stack represents a stack of program counters.
type stack []uintptr
func (s *stack) Format(st fmt.State, verb rune) {
switch verb {
case 'v':
switch {
case st.Flag('+'):
for _, pc := range *s {
f := Frame(pc)
fmt.Fprintf(st, "\n%+v", f)
}
}
}
}
func (s *stack) StackTrace() StackTrace {
f := make([]Frame, len(*s))
for i := 0; i < len(f); i++ {
f[i] = Frame((*s)[i])
}
return f
}
func callers() *stack {
const depth = 32
var pcs [depth]uintptr
n := runtime.Callers(3, pcs[:])
var st stack = pcs[0:n]
return &st
}
// funcname removes the path prefix component of a function's name reported by func.Name().
func funcname(name string) string {
i := strings.LastIndex(name, "/")
name = name[i+1:]
i = strings.Index(name, ".")
return name[i+1:]
}
func ErrorChain(err error) []string {
var results []string
if err == nil {
return results
}
depth := 0
next := err
for {
if depth > 10 {
break
}
results = append(results, next.Error())
next = go_errors.Unwrap(next)
if next == nil {
break
}
depth = depth + 1
}
return results
}