@@ -8,6 +8,20 @@ use crate::proto::kvrpcpb;
88use crate :: region:: RegionVerId ;
99use crate :: BoundRange ;
1010
11+ /// Protobuf-generated region-level error returned by TiKV.
12+ ///
13+ /// This type is generated from TiKV's protobuf definitions and may change in a
14+ /// future release even if the wire format is compatible.
15+ #[ doc( inline) ]
16+ pub use crate :: proto:: errorpb:: Error as ProtoRegionError ;
17+
18+ /// Protobuf-generated per-key error returned by TiKV.
19+ ///
20+ /// This type is generated from TiKV's protobuf definitions and may change in a
21+ /// future release even if the wire format is compatible.
22+ #[ doc( inline) ]
23+ pub use crate :: proto:: kvrpcpb:: KeyError as ProtoKeyError ;
24+
1125/// An error originating from the TiKV client or dependencies.
1226#[ derive( Debug , Error ) ]
1327#[ allow( clippy:: large_enum_variant) ]
@@ -63,13 +77,13 @@ pub enum Error {
6377 Canceled ( #[ from] futures:: channel:: oneshot:: Canceled ) ,
6478 /// Errors caused by changes of region information
6579 #[ error( "Region error: {0:?}" ) ]
66- RegionError ( Box < crate :: proto :: errorpb :: Error > ) ,
80+ RegionError ( Box < ProtoRegionError > ) ,
6781 /// Whether the transaction is committed or not is undetermined
6882 #[ error( "Whether the transaction is committed or not is undetermined" ) ]
6983 UndeterminedError ( Box < Error > ) ,
70- /// Wraps `crate::proto::kvrpcpb::KeyError`
84+ /// Wraps a per-key error returned by TiKV.
7185 #[ error( "{0:?}" ) ]
72- KeyError ( Box < crate :: proto :: kvrpcpb :: KeyError > ) ,
86+ KeyError ( Box < ProtoKeyError > ) ,
7387 /// Multiple errors generated from the ExtractError plan.
7488 #[ error( "Multiple errors: {0:?}" ) ]
7589 ExtractedErrors ( Vec < Error > ) ,
@@ -116,14 +130,14 @@ pub enum Error {
116130 TxnNotFound ( kvrpcpb:: TxnNotFound ) ,
117131}
118132
119- impl From < crate :: proto :: errorpb :: Error > for Error {
120- fn from ( e : crate :: proto :: errorpb :: Error ) -> Error {
133+ impl From < ProtoRegionError > for Error {
134+ fn from ( e : ProtoRegionError ) -> Error {
121135 Error :: RegionError ( Box :: new ( e) )
122136 }
123137}
124138
125- impl From < crate :: proto :: kvrpcpb :: KeyError > for Error {
126- fn from ( e : crate :: proto :: kvrpcpb :: KeyError ) -> Error {
139+ impl From < ProtoKeyError > for Error {
140+ fn from ( e : ProtoKeyError ) -> Error {
127141 Error :: KeyError ( Box :: new ( e) )
128142 }
129143}
0 commit comments