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

dig: constructor returns #283

Closed
glibsm opened this issue Feb 17, 2017 · 0 comments · Fixed by #375
Closed

dig: constructor returns #283

glibsm opened this issue Feb 17, 2017 · 0 comments · Fixed by #375

Comments

@glibsm
Copy link
Collaborator

glibsm commented Feb 17, 2017

Right now it's required that constructors return one and only one value: a pointer.

@dmcaulay pointed out it might be useful to return *ptr, error, in case constructors fail to initialize for one reason or another.

@glibsm glibsm mentioned this issue Feb 17, 2017
2 tasks
abhinav added a commit that referenced this issue Mar 8, 2017
This allows constructors to fail with an error. So you can now use the
following as a constructor with `Graph.Register`.

    func NewMyResult(...) (*MyResult, error) {
        // ..
    }

The error is wrapped for every layer of resolve so that you get,

    unable to resolve *Foo:
      unable to resolve *Bar:
        unable to resolve *MyResult:
          root cause

Resolves #283
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant