# Variable OnError

**URL:** <https://forums.kodeco.com/t/variable-onerror/35348>\
**Category:** RxSwift\
**Created:** [October 9, 2017, 8:23am UTC](https://forums.kodeco.com/t/variable-onerror/35348 "2017-10-09T08:23:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew314](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/andrew314/32/92629_2.png) [@andrew314](https://forums.kodeco.com/u/andrew314)\
**Post date:** [October 9, 2017, 8:23am UTC](https://forums.kodeco.com/t/variable-onerror/35348/1 "2017-10-09T08:23:11Z")

</div>

Hi

Chapter 3, Variables

```
// These will all generate errors
variable.value.onError(MyError.anError)
variable.asObservable().onError(MyError.anError)
variable.value = MyError.anError
variable.value.onCompleted()
variable.asObservable().onCompleted()

```

this code seems to be wrong

it looks like there is no straightforward way to publish an error on variable

is it so?

---

<div class="post-metadata">

**Author:** ![icanzilb](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/icanzilb/32/109333_2.png) [@icanzilb](https://forums.kodeco.com/u/icanzilb)\
**Post date:** [October 9, 2017, 8:37am UTC](https://forums.kodeco.com/t/variable-onerror/35348/2 "2017-10-09T08:37:45Z")

</div>

hi andrew - as the comment suggests all of these aren’t valid code

---

<div class="post-metadata">

**Author:** ![andrew314](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/andrew314/32/92629_2.png) [@andrew314](https://forums.kodeco.com/u/andrew314)\
**Post date:** [October 9, 2017, 8:51am UTC](https://forums.kodeco.com/t/variable-onerror/35348/3 "2017-10-09T08:51:36Z")

</div>

thnx, i’ve confused errors) my bad

---

<div class="post-metadata">

**Author:** ![icanzilb](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/icanzilb/32/109333_2.png) [@icanzilb](https://forums.kodeco.com/u/icanzilb)\
**Post date:** [October 9, 2017, 9:11am UTC](https://forums.kodeco.com/t/variable-onerror/35348/4 "2017-10-09T09:11:31Z")

</div>

😂 no worries, I know it can be overwhelming in the first chapters

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [March 25, 2018, 12:23am UTC](https://forums.kodeco.com/t/variable-onerror/35348/5 "2018-03-25T00:23:15Z")

</div>

This topic was automatically closed after 166 days. New replies are no longer allowed.
