<BlockSwitcher>

<Block name="Async/Await">

```swift
do {
    try await Amplify.DataStore.save(
        post,
        where: Post.keys.title.beginsWith("[Amplify]"))
    print("Post updated successfully!")
} catch let error as DataStoreError {
    print("Could not update post, maybe the title has been changed? - \(error)")
} catch {
    print("Unexpected error \(error)")
}
```

</Block>

<Block name="Combine">

```swift
let sink = Amplify.Publisher.create {
    try await Amplify.DataStore.save(
        post,
        where: Post.keys.title.beginsWith("[Amplify]"))
}.sink {
    if case let .failure(error) = $0 {
        print("Could not update post, maybe the title has been changed? - \(error)")
    }
}
receiveValue: { _ in
    print("Post updated successfully!")
}
```

</Block>

</BlockSwitcher>
