Provide a way to determine if a durable object is broken from errors#151
Provide a way to determine if a durable object is broken from errors#151
Conversation
src/workerd/jsg/util.c++
Outdated
There was a problem hiding this comment.
nit: Since we aren't modifying isDurableObjectBroken and it's a primitive, it feels like we should pass a value.
There was a problem hiding this comment.
Ahhhh, good point! And it should all inline better if the lambda only has arguments anyway.
MellowYarker
left a comment
There was a problem hiding this comment.
Thanks for doing this, I remember R2 had mentioned wanting this!
e6a1961 to
9ea31c4
Compare
src/workerd/jsg/util.c++
Outdated
| return jsg::check( | ||
| obj->Set( | ||
| isolate->GetCurrentContext(), | ||
| jsg::v8Str(isolate, "isDurableObjectReset"_kj, v8::NewStringType::kInternalized), |
There was a problem hiding this comment.
The is prefix here seems a bit inconsistent with the .remote field (i.e. it's .remote, not .isRemote). I don't feel super strongly, but I think just .durableObjectReset would match better.
There was a problem hiding this comment.
Hmmmmm, I'd be curious as to @jasnell 's opinion here. I considered naming parity with .remote but .durableObjectReset didn't feel like a property name for a boolean to me.
There was a problem hiding this comment.
I agree with @a-robinson here. I'm not a fan of the is* prefix on getters for JavaScript types.
There was a problem hiding this comment.
I'll change it over!
9ea31c4 to
d7f0388
Compare
Currently, workers have to rely upon the `Error.message` value to determine if their durable object is reset. Usually, the worker will want to retry their request to reinitialize their durable object and continue work. Thus we want to set a property like the existing `Error.remote` property to convey that the the request failed because the durable object became reset.
d7f0388 to
7ff63aa
Compare
|
If we had the more general |
Yes, but it would have been a not so great reason. :)
If request B is rejected with |
Currently, workers have to rely upon the
Error.messagevalue to determine if their durable object is broken. Usually, the worker will want to retry their request to reinitialize their durable object and continue work. Thus we want to set a property like the existingError.remoteproperty to convey that the the request failed because the durable object became broken.