--
Alan Burlison
--
--
--- You received this message because you are subscribed to the Google Groups "Akka User List" group.Read the docs: http://akka.io/docs/
Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
Search the archives: https://groups.google.com/group/akka-user
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscribe@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
--
Alan Burlison
--
--
--- You received this message because you are subscribed to the Google Groups "Akka User List" group.Read the docs: http://akka.io/docs/
Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
Search the archives: https://groups.google.com/group/akka-user
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscribe@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
--
Alan Burlison
--
--
--- You received this message because you are subscribed to the Google Groups "Akka User List" group.Read the docs: http://akka.io/docs/
Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
Search the archives: https://groups.google.com/group/akka-user
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscribe@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
Ahah! I think you may of nailed it... Thanks!
Indeed you did nail it - "thanks" doesn't come close as I'd looked at this for so long that I'd gone completely snow-blind ;-)
Is there a convenient shorthand way of mapping between a scala.util.Success and an akka.actor.Status.Success, or should I just do it with a match expression? What I'm doing is wrapping the IO functions that could fail in a "Try { ??? }" and returning the result to the calling actor.
Is there a reason why there's both scala.util.Success and an akka.actor.Status.Success?
--
Alan Burlison
--
--
--- You received this message because you are subscribed to the Google Groups "Akka User List" group.Read the docs: http://akka.io/docs/
Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
Search the archives: https://groups.google.com/group/akka-user
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscribe@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
On 01/02/17 09:06, Viktor Klang wrote:
You're welcome. A reminder that the actual error messages are very
important to include. :)
Yes, I consider my wrist to be slapped ;-) Thanks again!
If there is no method in the java/scaladoc then you'll need to convert
manually.
If there is I haven't been able to spot it.
And if you need a shorthand, it should be a one-liner def. ;)
Well, nearly ;-) I just copied the "Try {???}" implementation but made it return Akka Status values rather those used by Try - I don't need any operations other than to return the Akka success types.
def actorTry[T](f: => T): akka.actor.Status.Status = {
try {
akka.actor.Status.Success(f)
} catch {
case NonFatal(e) => akka.actor.Status.Failure(e)
}
}
then in the receive method:
case Read(from, to, reader) => sender ! actorTry { read(from, to, reader) }
IIRC akka.actor.Status.Success was created aeons ago,
scala.util.Success was added with scala.util.Try, so they have
separate origins. (just like java.util.List and
scala.collection.immutable.List)
Ah, the curse of history :-) Sounds completely plausible - thanks.
--
Alan Burlison
--
--
--- You received this message because you are subscribed to the Google Groups "Akka User List" group.Read the docs: http://akka.io/docs/
Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
Search the archives: https://groups.google.com/group/akka-user
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscribe@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.