package comm

import (
	"errors"
	"fmt"
	"go_dreamfactory/pb"
	"strings"
	"testing"
)

func TestErro(t *testing.T) {
	err := findUser("ddada")
	if err != nil {
		var customErr = new(CustomError)
		if errors.As(err, &customErr) {
			if customErr.Code == pb.ErrorCode_UserSessionNobeing {
				fmt.Println("用户不存在")
			}
		}
	}
}

func findUser(uid string) error {
	if strings.Contains(uid, "z_") {
		return NewCustomError(pb.ErrorCode_UserSessionNobeing)
	}
	return nil
}
