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

tryWith should return Try[T] instead of T #18

Closed
kevin-lee opened this issue May 13, 2016 · 0 comments
Closed

tryWith should return Try[T] instead of T #18

kevin-lee opened this issue May 13, 2016 · 0 comments
Assignees
Milestone

Comments

@kevin-lee
Copy link
Owner

tryWith should return Try instead of return a result or throwing an exception.

The current tryWith returns the direct result or throws an exception.

// result is what resource.doSomething() returns
// or if anything goes wrong, it may throw an exception.
val result = tryWith(someCloseable) { resource =>
  resource.doSomething()
}

It needs to use Try instead of dealing directly with an exception or the result.

// result is either Success[T] where T is the type of the value resource.doSomething() returns
// or Failure containing an exception (Throwable) if the exception was thrown.
val result = tryWith(someCloseable) { resource =>
  resource.doSomething()
}
@kevin-lee kevin-lee self-assigned this May 13, 2016
@kevin-lee kevin-lee added this to the 0.0.5 milestone May 13, 2016
kevin-lee added a commit that referenced this issue May 14, 2016
…sted tryWiths.

- #18 was dropped
- Changed:
  = release note for v0.0.5
  = Scaladoc for tryWith
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant