Verified Commit 9a75ec30 authored by Hercules Merscher's avatar Hercules Merscher 🌴
Browse files

docs: Updating README to clarify about resume block

parent 1cdf5deb
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -119,7 +119,9 @@ experience.complete

#### Resuming Experiences

You can resume a covered experience that was previously started and stored in the context. This is useful for distributed operations or when work spans multiple processes:
You can resume a covered experience that was previously started and stored in the context. This is useful for distributed operations or when work spans multiple processes.

Just like the start method, we can use a block to automatically complete a covered experience:

```ruby
# Resume an experience from context (with block)
@@ -133,6 +135,7 @@ Labkit::CoveredExperience.resume(:merge_request_creation) do |experience|
  send_notifications
end
```
Or manually:

```ruby
# Resume an experience from context (manual control)
@@ -146,7 +149,7 @@ experience.checkpoint
experience.complete
```

**Note:** The `resume` method loads the start time from the Labkit context. If no experience data exists in the context, it behaves the same as calling methods on an unstarted experience (raises `UnstartedError` in development/test environments, or safely ignores in other environments).
**Note:** The `resume` method loads the start time from the Labkit context. If no covered experience data exists in the context, it behaves the same as calling methods on an unstarted experience (raises `UnstartedError` in development/test environments, or safely ignores in other environments).

### Error Handling