File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
crates/generic_log_worker/src Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -148,18 +148,12 @@ pub fn get_durable_object_stub(
148148/// Gets the value from the given DO storage backend with the given key. Returns `Ok(None)` if no such
149149/// key exists.
150150async fn get_maybe < T : DeserializeOwned > ( storage : & Storage , key : & str ) -> Result < Option < T > > {
151- let res = storage. get :: < T > ( key) . await ;
152-
153- // Return None if the result of the get is
154- // worker::Error::from(JsValue:from("No such value in storage."))
155- if let Err ( Error :: JsError ( ref e) ) = res {
156- if e == "No such value in storage." {
157- return Ok ( None ) ;
158- }
151+ match storage. get :: < T > ( key) . await {
152+ Ok ( val) => Ok ( Some ( val) ) ,
153+ // Return None if the result of the get is "No such value in storage."
154+ Err ( Error :: JsError ( ref e) ) if e == "No such value in storage." => Ok ( None ) ,
155+ Err ( e) => Err ( e) ,
159156 }
160-
161- // In any other case, we either have a real return value or an error
162- res. map ( Option :: Some )
163157}
164158
165159/// Return a handle for the public R2 bucket from which to serve this log's
You can’t perform that action at this time.
0 commit comments