@@ -45,7 +45,7 @@ pub enum ErrorCode {
4545 BadRequest ,
4646 Unauthenticated ,
4747 Forbidden ,
48- TransientNotFound ,
48+ NotFound ,
4949 ClientDisconnect ,
5050 RateLimited ,
5151
@@ -91,17 +91,17 @@ impl ErrorMetadata {
9191 /// a deterministic user error. It should typically be used when the
9292 /// resource can't be currently found, e.g. the backend is not currently
9393 /// in service discovery. If the UDF is missing, this should throw
94- /// `bad_request`` insteaFd , which is a deterministic user error.
94+ /// `bad_request`` instead , which is a deterministic user error.
9595 ///
9696 /// The short_msg should be a CapitalCamelCased describing the error (eg
9797 /// FileNotFound). The msg should be a descriptive message targeted
9898 /// toward the developer.
99- pub fn transient_not_found (
99+ pub fn not_found (
100100 short_msg : impl Into < Cow < ' static , str > > ,
101101 msg : impl Into < Cow < ' static , str > > ,
102102 ) -> Self {
103103 Self {
104- code : ErrorCode :: TransientNotFound ,
104+ code : ErrorCode :: NotFound ,
105105 short_msg : short_msg. into ( ) ,
106106 msg : msg. into ( ) ,
107107 }
@@ -331,8 +331,8 @@ impl ErrorMetadata {
331331 self . code == ErrorCode :: BadRequest
332332 }
333333
334- pub fn is_transient_not_found ( & self ) -> bool {
335- self . code == ErrorCode :: TransientNotFound
334+ pub fn is_not_found ( & self ) -> bool {
335+ self . code == ErrorCode :: NotFound
336336 }
337337
338338 pub fn is_overloaded ( & self ) -> bool {
@@ -358,7 +358,7 @@ impl ErrorMetadata {
358358 | ErrorCode :: Forbidden => true ,
359359 ErrorCode :: OperationalInternalServerError
360360 | ErrorCode :: ClientDisconnect
361- | ErrorCode :: TransientNotFound
361+ | ErrorCode :: NotFound
362362 | ErrorCode :: RateLimited
363363 | ErrorCode :: OCC
364364 | ErrorCode :: OutOfRetention
@@ -377,7 +377,7 @@ impl ErrorMetadata {
377377 ErrorCode :: ClientDisconnect => None ,
378378 ErrorCode :: RateLimited => Some ( ( sentry:: Level :: Info , Some ( 0.01 ) ) ) ,
379379 ErrorCode :: BadRequest
380- | ErrorCode :: TransientNotFound
380+ | ErrorCode :: NotFound
381381 | ErrorCode :: PaginationLimit
382382 | ErrorCode :: Unauthenticated
383383 | ErrorCode :: Forbidden
@@ -402,7 +402,7 @@ impl ErrorMetadata {
402402 | ErrorCode :: ClientDisconnect
403403 | ErrorCode :: MisdirectedRequest
404404 | ErrorCode :: RateLimited => None ,
405- ErrorCode :: TransientNotFound => Some ( "transient_not_found " ) ,
405+ ErrorCode :: NotFound => Some ( "not_found " ) ,
406406 ErrorCode :: OCC => Some ( "occ" ) ,
407407 ErrorCode :: OutOfRetention => Some ( "out_of_retention" ) ,
408408 ErrorCode :: Overloaded => Some ( "overloaded" ) ,
@@ -424,7 +424,7 @@ impl ErrorMetadata {
424424 ErrorCode :: Unauthenticated => Some ( & crate :: metrics:: SYNC_AUTH_ERROR_TOTAL ) ,
425425 ErrorCode :: Forbidden => Some ( & crate :: metrics:: FORBIDDEN_ERROR_TOTAL ) ,
426426 ErrorCode :: OCC => Some ( & crate :: metrics:: COMMIT_RACE_TOTAL ) ,
427- ErrorCode :: TransientNotFound => None ,
427+ ErrorCode :: NotFound => None ,
428428 ErrorCode :: PaginationLimit => None ,
429429 ErrorCode :: OutOfRetention => None ,
430430 ErrorCode :: Overloaded => None ,
@@ -436,7 +436,7 @@ impl ErrorMetadata {
436436
437437 pub fn close_frame ( & self ) -> Option < CloseFrame < ' static > > {
438438 let code = match self . code {
439- ErrorCode :: TransientNotFound
439+ ErrorCode :: NotFound
440440 | ErrorCode :: PaginationLimit
441441 | ErrorCode :: Forbidden
442442 | ErrorCode :: ClientDisconnect => Some ( CloseCode :: Normal ) ,
@@ -473,7 +473,7 @@ impl ErrorCode {
473473 // https://stackoverflow.com/questions/3297048/403-forbidden-vs-401-unauthorized-http-responses
474474 ErrorCode :: Unauthenticated => StatusCode :: UNAUTHORIZED ,
475475 ErrorCode :: Forbidden => StatusCode :: FORBIDDEN ,
476- ErrorCode :: TransientNotFound => StatusCode :: NOT_FOUND ,
476+ ErrorCode :: NotFound => StatusCode :: NOT_FOUND ,
477477 ErrorCode :: RateLimited => StatusCode :: TOO_MANY_REQUESTS ,
478478 ErrorCode :: OperationalInternalServerError => StatusCode :: INTERNAL_SERVER_ERROR ,
479479 ErrorCode :: OCC
@@ -490,7 +490,7 @@ impl ErrorCode {
490490 ErrorCode :: BadRequest => tonic:: Code :: InvalidArgument ,
491491 ErrorCode :: Unauthenticated => tonic:: Code :: Unauthenticated ,
492492 ErrorCode :: Forbidden => tonic:: Code :: FailedPrecondition ,
493- ErrorCode :: TransientNotFound => tonic:: Code :: NotFound ,
493+ ErrorCode :: NotFound => tonic:: Code :: NotFound ,
494494 ErrorCode :: ClientDisconnect => tonic:: Code :: Aborted ,
495495 ErrorCode :: Overloaded | ErrorCode :: RejectedBeforeExecution | ErrorCode :: RateLimited => {
496496 tonic:: Code :: ResourceExhausted
@@ -507,7 +507,7 @@ impl ErrorCode {
507507 match code {
508508 StatusCode :: UNAUTHORIZED => Some ( ErrorCode :: Unauthenticated ) ,
509509 StatusCode :: FORBIDDEN => Some ( ErrorCode :: Forbidden ) ,
510- StatusCode :: NOT_FOUND => Some ( ErrorCode :: TransientNotFound ) ,
510+ StatusCode :: NOT_FOUND => Some ( ErrorCode :: NotFound ) ,
511511 StatusCode :: TOO_MANY_REQUESTS => Some ( ErrorCode :: RateLimited ) ,
512512 StatusCode :: MISDIRECTED_REQUEST => Some ( ErrorCode :: MisdirectedRequest ) ,
513513 // Tries to categorize in one of the above more specific 4xx codes first,
@@ -525,7 +525,7 @@ pub trait ErrorMetadataAnyhowExt {
525525 fn is_unauthenticated ( & self ) -> bool ;
526526 fn is_out_of_retention ( & self ) -> bool ;
527527 fn is_bad_request ( & self ) -> bool ;
528- fn is_transient_not_found ( & self ) -> bool ;
528+ fn is_not_found ( & self ) -> bool ;
529529 fn is_overloaded ( & self ) -> bool ;
530530 fn is_rejected_before_execution ( & self ) -> bool ;
531531 fn is_forbidden ( & self ) -> bool ;
@@ -587,9 +587,9 @@ impl ErrorMetadataAnyhowExt for anyhow::Error {
587587 }
588588
589589 /// Returns true if error is tagged as NotFound
590- fn is_transient_not_found ( & self ) -> bool {
590+ fn is_not_found ( & self ) -> bool {
591591 if let Some ( e) = self . downcast_ref :: < ErrorMetadata > ( ) {
592- return e. is_transient_not_found ( ) ;
592+ return e. is_not_found ( ) ;
593593 }
594594 false
595595 }
@@ -795,7 +795,7 @@ mod proptest {
795795 fn arbitrary_with ( ( ) : Self :: Parameters ) -> Self :: Strategy {
796796 any :: < ErrorCode > ( ) . prop_map ( |ec| match ec {
797797 ErrorCode :: BadRequest => ErrorMetadata :: bad_request ( "bad" , "request" ) ,
798- ErrorCode :: TransientNotFound => ErrorMetadata :: transient_not_found ( "not" , "found" ) ,
798+ ErrorCode :: NotFound => ErrorMetadata :: not_found ( "not" , "found" ) ,
799799 ErrorCode :: PaginationLimit => {
800800 ErrorMetadata :: pagination_limit ( "pagination" , "limit" )
801801 } ,
@@ -839,7 +839,7 @@ mod tests {
839839 // Error has visibility through sentry or custom metric.
840840 assert!( err. should_report_to_sentry( ) . is_some( ) || err. custom_metric( ) . is_some( ) ) ;
841841 if err. metric_server_error_label( ) . is_some( )
842- && err. code != ErrorCode :: TransientNotFound {
842+ && err. code != ErrorCode :: NotFound {
843843 assert!( err. should_report_to_sentry( ) . unwrap( ) . 0 >= sentry:: Level :: Warning ) ;
844844 if err. code == ErrorCode :: Overloaded ||
845845 err. code == ErrorCode :: RejectedBeforeExecution {
0 commit comments