This is an automated email from the ASF dual-hosted git repository.
pjfanning pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko.git
The following commit(s) were added to refs/heads/main by this push:
new 6287b9de07 Include exception type in StatusReply toString when not
text (#3271)
6287b9de07 is described below
commit 6287b9de076993b3577560f575b93f5eab6e0f37
Author: PJ Fanning <[email protected]>
AuthorDate: Tue Jun 30 08:23:00 2026 +0100
Include exception type in StatusReply toString when not text (#3271)
* StatusReply toString should include exception class name
* Update StatusReply.scala
* Add import for StatusReply.ErrorMessage
---
.../src/test/scala/org/apache/pekko/pattern/StatusReplySpec.scala | 4 ++++
actor/src/main/scala/org/apache/pekko/pattern/StatusReply.scala | 6 ++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git
a/actor-tests/src/test/scala/org/apache/pekko/pattern/StatusReplySpec.scala
b/actor-tests/src/test/scala/org/apache/pekko/pattern/StatusReplySpec.scala
index ec88a1c9f9..019311eebb 100644
--- a/actor-tests/src/test/scala/org/apache/pekko/pattern/StatusReplySpec.scala
+++ b/actor-tests/src/test/scala/org/apache/pekko/pattern/StatusReplySpec.scala
@@ -64,6 +64,10 @@ class StatusReplySpec extends PekkoSpec with ScalaFutures {
}
}
+ "include exception type in toString for non text-error" in {
+ StatusReply.Error(TestException("boho!")).toString should
include("TestException")
+ }
+
"flatten a Future[StatusReply]" in {
import system.dispatcher
StatusReply.flattenStatusFuture(Future(StatusReply.Success("woho"))).futureValue
should ===("woho")
diff --git a/actor/src/main/scala/org/apache/pekko/pattern/StatusReply.scala
b/actor/src/main/scala/org/apache/pekko/pattern/StatusReply.scala
index 87a2aa8cff..47a3a7b015 100644
--- a/actor/src/main/scala/org/apache/pekko/pattern/StatusReply.scala
+++ b/actor/src/main/scala/org/apache/pekko/pattern/StatusReply.scala
@@ -24,6 +24,7 @@ import org.apache.pekko
import pekko.Done
import pekko.actor.InvalidMessageException
import pekko.annotation.InternalApi
+import pekko.pattern.StatusReply.ErrorMessage
/**
* Generic top-level message type for replies that signal failure or success.
Convenient to use together with the
@@ -64,8 +65,9 @@ final class StatusReply[+T] private (private val status:
Try[T]) {
override def hashCode(): Int = status.hashCode
override def toString: String = status match {
- case ScalaSuccess(t) => s"Success($t)"
- case ScalaFailure(ex) => s"Error(${ex.getMessage})"
+ case ScalaSuccess(t) => s"Success($t)"
+ case ScalaFailure(ex: ErrorMessage) => s"Error(${ex.getMessage})"
+ case ScalaFailure(ex) => s"Error($ex)"
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]