1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-03-19 21:18:07 +02:00
kratos/examples/errors/api/error_reason_errors.pb.go
包子 7b41acf241
add examples/errors (#1077)
* addd examples/errors
2021-06-17 17:57:23 +08:00

31 lines
953 B
Go

// Code generated by protoc-gen-go-errors. DO NOT EDIT.
package api
import (
fmt "fmt"
errors "github.com/go-kratos/kratos/v2/errors"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the kratos package it is being compiled against.
const _ = errors.SupportPackageIsVersion1
func IsUserNotFound(err error) bool {
e := errors.FromError(err)
return e.Reason == ErrorReason_USER_NOT_FOUND.String() && e.Code == 404
}
func ErrorUserNotFound(format string, args ...interface{}) *errors.Error {
return errors.New(404, ErrorReason_USER_NOT_FOUND.String(), fmt.Sprintf(format, args...))
}
func IsContentMissing(err error) bool {
e := errors.FromError(err)
return e.Reason == ErrorReason_CONTENT_MISSING.String() && e.Code == 400
}
func ErrorContentMissing(format string, args ...interface{}) *errors.Error {
return errors.New(400, ErrorReason_CONTENT_MISSING.String(), fmt.Sprintf(format, args...))
}