@@ -59,24 +59,24 @@ pub trait ResultKind: fmt::Debug + 'static {
5959 /// Defines type of the error
6060 fn tp ( & self ) -> ResultType ;
6161
62- /// Error category
63- fn category ( & self ) -> & ' static str ;
62+ /// Error signature
63+ fn signature ( & self ) -> & ' static str ;
6464}
6565
6666pub trait ErrorKind : fmt:: Debug + ' static {
6767 /// Defines type of the error
6868 fn tp ( & self ) -> ResultType ;
6969
70- /// Error category
71- fn category ( & self ) -> & ' static str ;
70+ /// Error signature
71+ fn signature ( & self ) -> & ' static str ;
7272}
7373
7474impl ResultKind for ResultType {
7575 fn tp ( & self ) -> ResultType {
7676 * self
7777 }
7878
79- fn category ( & self ) -> & ' static str {
79+ fn signature ( & self ) -> & ' static str {
8080 self . as_str ( )
8181 }
8282}
@@ -141,7 +141,7 @@ mod tests {
141141 }
142142 }
143143
144- fn category ( & self ) -> & ' static str {
144+ fn signature ( & self ) -> & ' static str {
145145 match self {
146146 TestKind :: Connect => "Client-Connect" ,
147147 TestKind :: Disconnect => "Client-Disconnect" ,
@@ -201,7 +201,7 @@ mod tests {
201201 assert_eq ! ( ( * err) . kind( ) , TestKind :: ServiceError ) ;
202202 assert_eq ! ( err. to_string( ) , "InternalServiceError" ) ;
203203 assert_eq ! ( err. service( ) , Some ( "test" ) ) ;
204- assert_eq ! ( err. kind( ) . category ( ) , "Service-Internal" ) ;
204+ assert_eq ! ( err. kind( ) . signature ( ) , "Service-Internal" ) ;
205205 assert_eq ! (
206206 err,
207207 Into :: <Error <TestError >>:: into( TestError :: Service ( "409 Error" ) )
@@ -239,11 +239,17 @@ mod tests {
239239 assert_eq ! ( format!( "{}" , ResultType :: ClientError ) , "ClientError" ) ;
240240
241241 assert_eq ! ( TestKind :: Connect . to_string( ) , "Connect" ) ;
242- assert_eq ! ( TestError :: Connect ( "" ) . kind( ) . category ( ) , "Client-Connect" ) ;
242+ assert_eq ! ( TestError :: Connect ( "" ) . kind( ) . signature ( ) , "Client-Connect" ) ;
243243 assert_eq ! ( TestKind :: Disconnect . to_string( ) , "Disconnect" ) ;
244- assert_eq ! ( TestError :: Disconnect . kind( ) . category( ) , "Client-Disconnect" ) ;
244+ assert_eq ! (
245+ TestError :: Disconnect . kind( ) . signature( ) ,
246+ "Client-Disconnect"
247+ ) ;
245248 assert_eq ! ( TestKind :: ServiceError . to_string( ) , "ServiceError" ) ;
246- assert_eq ! ( TestError :: Service ( "" ) . kind( ) . category( ) , "Service-Internal" ) ;
249+ assert_eq ! (
250+ TestError :: Service ( "" ) . kind( ) . signature( ) ,
251+ "Service-Internal"
252+ ) ;
247253
248254 let err = err. into_error ( ) . chain ( ) ;
249255 assert_eq ! ( err. kind( ) , TestKind :: ServiceError ) ;
@@ -273,7 +279,7 @@ mod tests {
273279 assert_eq ! ( err. kind( ) , TestKind :: ServiceError ) ;
274280 assert_eq ! ( err. kind( ) , TestError :: Service ( "404 Error" ) . kind( ) ) ;
275281 assert_eq ! ( err. service( ) , Some ( "test" ) ) ;
276- assert_eq ! ( err. kind( ) . category ( ) , "Service-Internal" ) ;
282+ assert_eq ! ( err. kind( ) . signature ( ) , "Service-Internal" ) ;
277283 assert_eq ! ( err. to_string( ) , "InternalServiceError" ) ;
278284 assert ! ( err. backtrace( ) . is_some( ) ) ;
279285 assert ! ( format!( "{err:?}" ) . contains( "Service(\" 404 Error\" )" ) ) ;
@@ -282,7 +288,7 @@ mod tests {
282288 assert_eq ! ( 8 , mem:: size_of:: <Error <TestError >>( ) ) ;
283289
284290 assert_eq ! ( TestError2 . service( ) , None ) ;
285- assert_eq ! ( TestError2 . kind( ) . category ( ) , "ClientError" ) ;
291+ assert_eq ! ( TestError2 . kind( ) . signature ( ) , "ClientError" ) ;
286292
287293 // ErrorInformation
288294 let err: Error < TestError > = TestError :: Service ( "409 Error" ) . into ( ) ;
@@ -294,7 +300,7 @@ mod tests {
294300 let err: ErrorInfo = err. set_service ( "SVC" ) . into ( ) ;
295301 assert_eq ! ( err. tp( ) , ResultType :: ServiceError ) ;
296302 assert_eq ! ( err. service( ) , Some ( "SVC" ) ) ;
297- assert_eq ! ( err. category ( ) , "Service-Internal" ) ;
303+ assert_eq ! ( err. signature ( ) , "Service-Internal" ) ;
298304 assert ! ( err. backtrace( ) . is_some( ) ) ;
299305
300306 let res = Err ( TestError :: Service ( "409 Error" ) ) ;
@@ -327,7 +333,7 @@ mod tests {
327333 . try_map ( |_| Err :: < ( ) , _ > ( TestError2 ) )
328334 . err ( )
329335 . unwrap ( ) ;
330- assert_eq ! ( err3. kind( ) . category ( ) , "ClientError" ) ;
336+ assert_eq ! ( err3. kind( ) . signature ( ) , "ClientError" ) ;
331337 assert_eq ! ( err3. get_item:: <& str >( ) , Some ( & "Test" ) ) ;
332338
333339 let res = err. clone ( ) . try_map ( |_| Ok :: < _ , TestError2 > ( ( ) ) ) ;
0 commit comments