Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/src/alarm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ impl DurableObject for AlarmObject {
Response::ok(alarmed.to_string())
}

async fn alarm(&self) -> Result<Response> {
async fn alarm(&self) -> Result<()> {
self.state.storage().put("alarmed", true).await?;
console_log!("Alarm has been triggered!");
Response::ok("ALARMED")
Ok(())
}
}

Expand Down
3 changes: 1 addition & 2 deletions worker-macros/src/durable_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ mod bindgen_methods {

::worker::js_sys::futures::future_to_promise(::std::panic::AssertUnwindSafe(async move {
<Self as ::worker::DurableObject>::alarm(static_self).await
.map(::worker::worker_sys::web_sys::Response::from)
.map(::worker::wasm_bindgen::JsValue::from)
.map(|_| ::worker::wasm_bindgen::JsValue::NULL)
.map_err(::worker::wasm_bindgen::JsValue::from)
}))
}
Expand Down
2 changes: 1 addition & 1 deletion worker/src/durable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ pub trait DurableObject: has_durable_object_attribute {
async fn fetch(&self, req: Request) -> Result<Response>;

#[allow(clippy::diverging_sub_expression)]
async fn alarm(&self) -> Result<Response> {
async fn alarm(&self) -> Result<()> {
worker_sys::console_error!("alarm() handler not implemented");
unimplemented!("alarm() handler")
}
Expand Down