You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2021/10/19 04:06:45 UTC
[james-project] 02/02: JAMES-3516 Fix Thread/get error management
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 869b1979917f9116c856787039cfc4132457aea2
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Oct 18 21:37:02 2021 +0700
JAMES-3516 Fix Thread/get error management
Unexpected errors should not be reported as `notFound` but should
lead to a top level method failure (`serverFail`)
---
.../main/scala/org/apache/james/jmap/method/ThreadGetMethod.scala | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/ThreadGetMethod.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/ThreadGetMethod.scala
index 8496d9f..13ea9d3 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/ThreadGetMethod.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/ThreadGetMethod.scala
@@ -27,6 +27,7 @@ import org.apache.james.jmap.core.{AccountId, Invocation, UuidState}
import org.apache.james.jmap.json.{ResponseSerializer, ThreadSerializer}
import org.apache.james.jmap.mail.{Thread, ThreadGetRequest, ThreadGetResponse, ThreadNotFound, UnparsedThreadId}
import org.apache.james.jmap.routes.SessionSupplier
+import org.apache.james.mailbox.exception.ThreadNotFoundException
import org.apache.james.mailbox.model.{ThreadId => JavaThreadId}
import org.apache.james.mailbox.{MailboxManager, MailboxSession}
import org.apache.james.metrics.api.MetricFactory
@@ -92,6 +93,9 @@ class ThreadGetMethod @Inject()(val metricFactory: MetricFactory,
.collectSeq()
.map(seq => Thread(id = unparsedThreadId.id, emailIds = seq.toList))
.map(ThreadGetResult.found)
- .onErrorResume((_ => SMono.just(ThreadGetResult.notFound(unparsedThreadId)))))
+ .onErrorResume({
+ case _: ThreadNotFoundException => SMono.just(ThreadGetResult.notFound(unparsedThreadId))
+ case e => SMono.error(e)
+ }))
})
}
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org