Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle errors thrown by derived observables #5

Open
phillipskevin opened this issue Aug 21, 2017 · 0 comments
Open

Handle errors thrown by derived observables #5

phillipskevin opened this issue Aug 21, 2017 · 0 comments

Comments

@phillipskevin
Copy link
Owner

My current thoughts are, if a derived observable throws an error, a separate stream should emit a value.

So if you had

class Foo {
  @observable
  bar() {
    // something happens that causes an error
  }
}

var myFoo = new Foo();

foo.bar // "baz" -> good value
foo.bar // causes an error for some reason
foo.errors.bar // this would emit the error
foo.bar // this is still "baz"

This could also be configured somehow for the whole class and also for each property

@error("propertyErrors")
class Foo {
  @observable
  bar() {
    // something happens that causes an error
  }

  @observable({
    error: "bazError"
  })
  baz() {
    // something happens that causes an error
  }
}

var myFoo = new Foo();
myFoo.propertyErrors.bar // this is the errors for bar
myFoo.bazError // this is the errors for baz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant