You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2021/05/17 02:21:46 UTC

[james-project] 03/11: [REFACTORING] Reactor-Scala: raiseError is deprecated and error should be used

This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 1ac0fe76744305ec983adf80613630b17e8b42b0
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu May 13 15:24:26 2021 +0700

    [REFACTORING] Reactor-Scala: raiseError is deprecated and error should be used
    
    Underneath the call effects are strictly the same.
---
 .../apache/james/jmap/http/MailboxesProvisioner.scala    |  2 +-
 .../org/apache/james/jmap/mail/MailboxFactory.scala      |  6 +++---
 .../org/apache/james/jmap/method/EmailGetMethod.scala    |  6 +++---
 .../org/apache/james/jmap/method/EmailQueryMethod.scala  |  7 +++----
 .../org/apache/james/jmap/method/MDNParseMethod.scala    |  7 ++++---
 .../org/apache/james/jmap/method/MDNSendMethod.scala     |  8 ++++----
 .../org/apache/james/jmap/method/MailboxGetMethod.scala  |  2 +-
 .../apache/james/jmap/method/MailboxQueryMethod.scala    |  2 +-
 .../james/jmap/method/MailboxSetDeletePerformer.scala    |  2 +-
 .../james/jmap/method/MailboxSetUpdatePerformer.scala    |  2 +-
 .../main/scala/org/apache/james/jmap/method/Method.scala |  4 ++--
 .../org/apache/james/jmap/routes/DownloadRoutes.scala    | 16 ++++++++--------
 .../scala/org/apache/james/jmap/routes/JmapApi.scala     |  4 ++--
 .../org/apache/james/jmap/routes/UploadRoutes.scala      |  6 +++---
 .../org/apache/james/jmap/routes/JMAPApiRoutesTest.scala |  2 +-
 15 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/MailboxesProvisioner.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/MailboxesProvisioner.scala
index 2690ee5..742105a 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/MailboxesProvisioner.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/MailboxesProvisioner.scala
@@ -59,7 +59,7 @@ class MailboxesProvisioner @Inject() (mailboxManager: MailboxManager,
       SMono(mailboxManager.mailboxExists(mailboxPath, session))
         .map(exist => !exist)
     } catch {
-      case exception: MailboxException => SMono.raiseError(exception)
+      case exception: MailboxException => SMono.error(exception)
     }
   }
 
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/MailboxFactory.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/MailboxFactory.scala
index 4d092c3..50fff05 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/MailboxFactory.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/MailboxFactory.scala
@@ -129,7 +129,7 @@ class MailboxFactory @Inject() (subscriptionManager: SubscriptionManager, mailbo
     val sanitizedCounters: MailboxCounters = mailboxMetaData.getCounters.sanitize()
 
     MailboxValidation.validate(mailboxMetaData.getPath, mailboxSession.getPathDelimiter, sanitizedCounters.getUnseen, sanitizedCounters.getUnseen, sanitizedCounters.getCount, sanitizedCounters.getCount) match {
-      case Left(error) => SMono.raiseError(error)
+      case Left(error) => SMono.error(error)
       case scala.Right(mailboxValidation) =>
         SMono.fromPublisher(quotaLoader.getQuotas(mailboxMetaData.getPath))
           .map(quotas => {
@@ -169,7 +169,7 @@ class MailboxFactory @Inject() (subscriptionManager: SubscriptionManager, mailbo
       val sanitizedCounters: MailboxCounters = messageManager.getMailboxCounters(mailboxSession).sanitize()
 
       MailboxValidation.validate(messageManager.getMailboxPath, mailboxSession.getPathDelimiter, sanitizedCounters.getUnseen, sanitizedCounters.getUnseen, sanitizedCounters.getCount, sanitizedCounters.getCount) match {
-        case Left(error) => SMono.raiseError(error)
+        case Left(error) => SMono.error(error)
         case scala.Right(mailboxValidation) =>
           SMono.fromPublisher(quotaLoader.getQuotas(messageManager.getMailboxPath))
             .map(quotas => {
@@ -206,7 +206,7 @@ class MailboxFactory @Inject() (subscriptionManager: SubscriptionManager, mailbo
                 isSubscribed = isSubscribed)})
       }
     } catch {
-      case error: Exception => SMono.raiseError(error)
+      case error: Exception => SMono.error(error)
     }
   }
 }
\ No newline at end of file
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailGetMethod.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailGetMethod.scala
index 188ab96..41cb0d0 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailGetMethod.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailGetMethod.scala
@@ -87,7 +87,7 @@ class EmailGetMethod @Inject() (readerFactory: EmailViewReaderFactory,
   override def doProcess(capabilities: Set[CapabilityIdentifier], invocation: InvocationWithContext, mailboxSession: MailboxSession, request: EmailGetRequest): SMono[InvocationWithContext] = {
     computeResponseInvocation(request, invocation.invocation, mailboxSession).onErrorResume({
       case e: IllegalArgumentException => SMono.just(Invocation.error(ErrorCode.InvalidArguments, e.getMessage, invocation.invocation.methodCallId))
-      case e: Throwable => SMono.raiseError(e)
+      case e: Throwable => SMono.error(e)
     }).map(invocationResult => InvocationWithContext(invocationResult, invocation.processingContext))
   }
 
@@ -101,7 +101,7 @@ class EmailGetMethod @Inject() (readerFactory: EmailViewReaderFactory,
     validateProperties(request)
       .flatMap(properties => validateBodyProperties(request).map((properties, _)))
       .fold(
-        e => SMono.raiseError(e), {
+        e => SMono.error(e), {
           case (properties, bodyProperties) => getEmails(request, mailboxSession)
             .map(response => Invocation(
               methodName = methodName,
@@ -141,7 +141,7 @@ class EmailGetMethod @Inject() (readerFactory: EmailViewReaderFactory,
 
   private def getEmails(request: EmailGetRequest, mailboxSession: MailboxSession): SMono[EmailGetResponse] =
     request.ids match {
-      case None => SMono.raiseError(new IllegalArgumentException("ids can not be ommited for email/get"))
+      case None => SMono.error(new IllegalArgumentException("ids can not be ommited for email/get"))
       case Some(ids) => getEmails(ids, mailboxSession, request)
         .flatMap(result => SMono[JavaState](emailchangeRepository.getLatestState(JavaAccountId.fromUsername(mailboxSession.getUser)))
           .map(state => EmailGetResponse(
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailQueryMethod.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailQueryMethod.scala
index 6f08d44..186e80c 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailQueryMethod.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailQueryMethod.scala
@@ -42,7 +42,6 @@ import org.apache.james.metrics.api.MetricFactory
 import org.apache.james.util.streams.{Limit => JavaLimit}
 import play.api.libs.json.{JsError, JsSuccess}
 import reactor.core.scala.publisher.{SFlux, SMono}
-import reactor.core.scheduler.Schedulers
 
 import scala.jdk.CollectionConverters._
 
@@ -75,7 +74,7 @@ class EmailQueryMethod @Inject() (serializer: EmailQuerySerializer,
             arguments = Arguments(serializer.serialize(response)),
             methodCallId = invocation.methodCallId))
       }
-    validation.fold(SMono.raiseError, res => res)
+    validation.fold(SMono.error, res => res)
   }
 
   override def getRequest(mailboxSession: MailboxSession, invocation: Invocation): Either[Exception, EmailQueryRequest] =
@@ -115,7 +114,7 @@ class EmailQueryMethod @Inject() (serializer: EmailQuerySerializer,
         .collectSeq())
       .onErrorResume({
         case _: MailboxNotFoundException => SMono.just[Seq[MessageId]](Seq())
-        case e => SMono.raiseError[Seq[MessageId]](e)
+        case e => SMono.error[Seq[MessageId]](e)
       })
   }
 
@@ -129,7 +128,7 @@ class EmailQueryMethod @Inject() (serializer: EmailQuerySerializer,
         .collectSeq())
       .onErrorResume({
         case _: MailboxNotFoundException => SMono.just[Seq[MessageId]](Seq())
-        case e => SMono.raiseError[Seq[MessageId]](e)
+        case e => SMono.error[Seq[MessageId]](e)
       })
   }
 
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MDNParseMethod.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MDNParseMethod.scala
index bea693b..d0e52c5 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MDNParseMethod.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MDNParseMethod.scala
@@ -19,7 +19,10 @@
 
 package org.apache.james.jmap.method
 
+import java.io.InputStream
+
 import eu.timepit.refined.auto._
+import javax.inject.Inject
 import org.apache.james.jmap.core.CapabilityIdentifier.{CapabilityIdentifier, JMAP_CORE, JMAP_MAIL, JMAP_MDN}
 import org.apache.james.jmap.core.Invocation
 import org.apache.james.jmap.core.Invocation._
@@ -36,8 +39,6 @@ import org.apache.james.mime4j.message.DefaultMessageBuilder
 import play.api.libs.json.{JsError, JsObject, JsSuccess, Json}
 import reactor.core.scala.publisher.{SFlux, SMono}
 
-import java.io.InputStream
-import javax.inject.Inject
 import scala.jdk.OptionConverters._
 import scala.util.Try
 
@@ -113,7 +114,7 @@ class MDNParseMethod @Inject()(serializer: MDNSerializer,
     } yield {
       (mdn, message)
     }
-    maybeMdn.fold(_ => SMono.raiseError(BlobUnParsableException(blobId)), result => SMono.just(result))
+    maybeMdn.fold(_ => SMono.error(BlobUnParsableException(blobId)), result => SMono.just(result))
   }
 }
 
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MDNSendMethod.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MDNSendMethod.scala
index 261b6fb..aef5905 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MDNSendMethod.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MDNSendMethod.scala
@@ -20,6 +20,9 @@
 package org.apache.james.jmap.method
 
 import eu.timepit.refined.auto._
+import javax.annotation.PreDestroy
+import javax.inject.Inject
+import javax.mail.internet.MimeMessage
 import org.apache.james.jmap.core.CapabilityIdentifier.{CapabilityIdentifier, JMAP_CORE, JMAP_MAIL, JMAP_MDN}
 import org.apache.james.jmap.core.Invocation
 import org.apache.james.jmap.core.Invocation._
@@ -47,9 +50,6 @@ import play.api.libs.json.{JsError, JsObject, JsSuccess, Json}
 import reactor.core.scala.publisher.{SFlux, SMono}
 import reactor.core.scheduler.Schedulers
 
-import javax.annotation.PreDestroy
-import javax.inject.Inject
-import javax.mail.internet.MimeMessage
 import scala.jdk.CollectionConverters._
 import scala.jdk.OptionConverters._
 import scala.util.Try
@@ -78,7 +78,7 @@ class MDNSendMethod @Inject()(serializer: MDNSerializer,
                          request: MDNSendRequest): SFlux[InvocationWithContext] =
     identityResolver.resolveIdentityId(request.identityId, mailboxSession)
       .flatMap(maybeIdentity => maybeIdentity.map(identity => create(identity, request, mailboxSession, invocation.processingContext))
-        .getOrElse(SMono.raiseError(IdentityIdNotFoundException("The IdentityId cannot be found"))))
+        .getOrElse(SMono.error(IdentityIdNotFoundException("The IdentityId cannot be found"))))
       .flatMapMany(createdResults => {
         val explicitInvocation: InvocationWithContext = InvocationWithContext(
           invocation = Invocation(
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxGetMethod.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxGetMethod.scala
index fa0940a..6dae60f 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxGetMethod.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxGetMethod.scala
@@ -131,7 +131,7 @@ class MailboxGetMethod @Inject() (serializer: MailboxSerializer,
         .map(mailbox => filterShared(capabilities, mailbox))
         .onErrorResume {
           case _: MailboxNotFoundException => SMono.just(MailboxGetResults.notFound(mailboxId))
-          case error => SMono.raiseError(error)
+          case error => SMono.error(error)
         })
       .subscribeOn(Schedulers.elastic)
 
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxQueryMethod.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxQueryMethod.scala
index b19a8af..0483e18 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxQueryMethod.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxQueryMethod.scala
@@ -46,7 +46,7 @@ class MailboxQueryMethod @Inject()(systemMailboxesProvider: SystemMailboxesProvi
           errorCode = ErrorCode.InvalidArguments,
           description = e.getMessage,
           methodCallId = invocation.invocation.methodCallId))
-      case e: Throwable => SMono.raiseError(e)
+      case e: Throwable => SMono.error(e)
     }
       .map(invocationResult => InvocationWithContext(invocationResult, invocation.processingContext))
   }
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetDeletePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetDeletePerformer.scala
index 66704e1..c19c02e 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetDeletePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetDeletePerformer.scala
@@ -74,7 +74,7 @@ class MailboxSetDeletePerformer @Inject()(mailboxManager: MailboxManager,
 
   private def delete(mailboxSession: MailboxSession, id: UnparsedMailboxId, onDestroy: RemoveEmailsOnDestroy): SMono[MailboxDeletionResult] = {
     MailboxGet.parse(mailboxIdFactory)(id)
-      .fold(e => SMono.raiseError(e),
+      .fold(e => SMono.error(e),
         id => SMono.fromCallable(() => doDelete(mailboxSession, id, onDestroy))
           .subscribeOn(Schedulers.elastic())
           .`then`(SMono.just[MailboxDeletionResult](MailboxDeletionSuccess(id))))
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetUpdatePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetUpdatePerformer.scala
index 0b41a86..fbf56fb 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetUpdatePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetUpdatePerformer.scala
@@ -102,7 +102,7 @@ class MailboxSetUpdatePerformer @Inject()(serializer: MailboxSerializer,
                             patch: MailboxPatchObject,
                             capabilities: Set[CapabilityIdentifier]): SMono[MailboxUpdateResult] = {
     patch.validate(mailboxIdFactory, serializer, capabilities, mailboxSession)
-      .fold(e => SMono.raiseError(e), validatedPatch =>
+      .fold(e => SMono.error(e), validatedPatch =>
         updateMailboxRights(mailboxId, validatedPatch, mailboxSession)
           .`then`(updateSubscription(mailboxId, validatedPatch, mailboxSession))
           .`then`(updateMailboxPath(mailboxId, unparsedMailboxId, validatedPatch, mailboxSession)))
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/Method.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/Method.scala
index 4e149d5..557ae2e 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/Method.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/Method.scala
@@ -61,7 +61,7 @@ trait MethodRequiringAccountId[REQUEST <: WithAccountId] extends Method {
       doProcess(capabilities, invocation, mailboxSession, request)
     }
 
-    val result: SFlux[InvocationWithContext] = SFlux.fromPublisher(either.fold(e => SFlux.raiseError[InvocationWithContext](e), r => r))
+    val result: SFlux[InvocationWithContext] = SFlux.fromPublisher(either.fold(e => SFlux.error[InvocationWithContext](e), r => r))
       .onErrorResume[InvocationWithContext] {
         case e: AccountNotFoundException => SFlux.just[InvocationWithContext] (InvocationWithContext(e.invocation, invocation.processingContext))
         case e: UnsupportedRequestParameterException => SFlux.just[InvocationWithContext] (InvocationWithContext(Invocation.error(
@@ -85,7 +85,7 @@ trait MethodRequiringAccountId[REQUEST <: WithAccountId] extends Method {
         case e: ChangeNotFoundException => SFlux.just[InvocationWithContext] (InvocationWithContext(Invocation.error(ErrorCode.CannotCalculateChanges, e.getMessage, invocation.invocation.methodCallId), invocation.processingContext))
         case e: RequestTooLargeException => SFlux.just[InvocationWithContext] (InvocationWithContext(Invocation.error(ErrorCode.RequestTooLarge, e.description, invocation.invocation.methodCallId), invocation.processingContext))
         case e: IdentityIdNotFoundException => SFlux.just[InvocationWithContext] (InvocationWithContext(Invocation.error(ErrorCode.InvalidArguments, e.description, invocation.invocation.methodCallId), invocation.processingContext))
-        case e: Throwable => SFlux.raiseError[InvocationWithContext] (e)
+        case e: Throwable => SFlux.error[InvocationWithContext] (e)
       }
 
     metricFactory.decoratePublisherWithTimerMetricLogP99(JMAP_RFC8621_PREFIX + methodName.value, result)
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/DownloadRoutes.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/DownloadRoutes.scala
index 841f3e2..83c7c7b 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/DownloadRoutes.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/DownloadRoutes.scala
@@ -130,7 +130,7 @@ class MessageBlobResolver @Inject()(val messageIdFactory: MessageId.Factory,
       case Success(messageId) => Applicable(SMono.fromPublisher(
         messageIdManager.getMessagesReactive(List(messageId).asJava, FetchGroup.FULL_CONTENT, mailboxSession))
         .map[Blob](MessageBlob(blobId, _))
-        .switchIfEmpty(SMono.raiseError(BlobNotFoundException(blobId))))
+        .switchIfEmpty(SMono.error(BlobNotFoundException(blobId))))
     }
   }
 }
@@ -142,7 +142,7 @@ class AttachmentBlobResolver @Inject()(val attachmentManager: AttachmentManager)
         Try(attachmentManager.getAttachment(attachmentId, mailboxSession)) match {
           case Success(attachmentMetadata) => Applicable(
             SMono.fromCallable(() => AttachmentBlob(attachmentMetadata, attachmentManager.load(attachmentMetadata, mailboxSession))))
-          case Failure(_) => Applicable(SMono.raiseError(BlobNotFoundException(blobId)))
+          case Failure(_) => Applicable(SMono.error(BlobNotFoundException(blobId)))
         }
 
       case _ => NonApplicable()
@@ -180,7 +180,7 @@ class MessagePartBlobResolver @Inject()(val messageIdFactory: MessageId.Factory,
                 .fold(sink.error(BlobNotFoundException(blobId)))(part => sink.next(part))
           }
           .map[Blob](EmailBodyPartBlob(blobId, _))
-          .switchIfEmpty(SMono.raiseError(BlobNotFoundException(blobId))))
+          .switchIfEmpty(SMono.error(BlobNotFoundException(blobId))))
     }
   }
 }
@@ -193,7 +193,7 @@ class BlobResolvers @Inject()(val messageBlobResolver: MessageBlobResolver,
       .resolve(blobId, mailboxSession).asOption
       .orElse(messagePartBlobResolver.resolve(blobId, mailboxSession).asOption)
       .orElse(attachmentBlobResolver.resolve(blobId, mailboxSession).asOption)
-      .getOrElse(SMono.raiseError(BlobNotFoundException(blobId)))
+      .getOrElse(SMono.error(BlobNotFoundException(blobId)))
 }
 
 class DownloadRoutes @Inject()(@Named(InjectionKeys.RFC_8621) val authenticator: Authenticator,
@@ -244,7 +244,7 @@ class DownloadRoutes @Inject()(@Named(InjectionKeys.RFC_8621) val authenticator:
 
   private def get(request: HttpServerRequest, response: HttpServerResponse, mailboxSession: MailboxSession): SMono[Unit] = {
     BlobId.of(request.param(blobIdParam))
-      .fold(e => SMono.raiseError(e),
+      .fold(e => SMono.error(e),
         blobResolvers.resolve(_, mailboxSession))
       .flatMap(blob => downloadBlob(
         optionalName = queryParam(request, nameParam),
@@ -262,15 +262,15 @@ class DownloadRoutes @Inject()(@Named(InjectionKeys.RFC_8621) val authenticator:
         val targetAccountId: AccountId = AccountId(id)
         AccountId.from(mailboxSession.getUser).map(accountId => accountId.equals(targetAccountId))
           .fold[SMono[Unit]](
-            e => SMono.raiseError(e),
+            e => SMono.error(e),
             value => if (value) {
               get(request, response, mailboxSession)
             } else {
-              SMono.raiseError(ForbiddenException())
+              SMono.error(ForbiddenException())
             })
       }
 
-      case Left(throwable: Throwable) => SMono.raiseError(throwable)
+      case Left(throwable: Throwable) => SMono.error(throwable)
     }
   }
 
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/JmapApi.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/JmapApi.scala
index 65a0320..3d19067 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/JmapApi.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/JmapApi.scala
@@ -21,7 +21,7 @@ package org.apache.james.jmap.routes
 import javax.inject.Inject
 import org.apache.james.jmap.core.CapabilityIdentifier.CapabilityIdentifier
 import org.apache.james.jmap.core.Invocation.MethodName
-import org.apache.james.jmap.core.{Capability, DefaultCapabilities, ErrorCode, Invocation, MissingCapabilityException, RequestObject, ResponseObject}
+import org.apache.james.jmap.core.{Capability, ErrorCode, Invocation, MissingCapabilityException, RequestObject, ResponseObject}
 import org.apache.james.jmap.method.{InvocationWithContext, Method}
 import org.apache.james.mailbox.MailboxSession
 import org.slf4j.{Logger, LoggerFactory}
@@ -50,7 +50,7 @@ class JMAPApi (methods: Set[Method], defaultCapabilities: Set[Capability]) {
     val capabilities: Set[CapabilityIdentifier] = requestObject.using.toSet
 
     if (unsupportedCapabilities.nonEmpty) {
-      SMono.raiseError(UnsupportedCapabilitiesException(unsupportedCapabilities))
+      SMono.error(UnsupportedCapabilitiesException(unsupportedCapabilities))
     } else {
       processSequentiallyAndUpdateContext(requestObject, mailboxSession, processingContext, capabilities)
         .map(invocations => ResponseObject(ResponseObject.SESSION_STATE, invocations.map(_.invocation)))
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/UploadRoutes.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/UploadRoutes.scala
index bdc5931..8e7996b 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/UploadRoutes.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/UploadRoutes.scala
@@ -136,7 +136,7 @@ class UploadRoutes @Inject()(@Named(InjectionKeys.RFC_8621) val authenticator: A
         val targetAccountId: AccountId = AccountId(id)
         AccountId.from(session.getUser).map(accountId => accountId.equals(targetAccountId))
           .fold[SMono[Void]](
-            e => SMono.raiseError(e),
+            e => SMono.error(e),
             value => if (value) {
               SMono.fromCallable(() => ReactorUtils.toInputStream(request.receive
                 // Unwrapping to byte array needed to solve data races and buffer reordering when using .asByteBuffer()
@@ -144,10 +144,10 @@ class UploadRoutes @Inject()(@Named(InjectionKeys.RFC_8621) val authenticator: A
                 .map(array => ByteBuffer.wrap(array))))
               .flatMap(content => handle(targetAccountId, contentType, content, session, response))
             } else {
-              SMono.raiseError(ForbiddenException())
+              SMono.error(ForbiddenException())
             })
 
-      case Left(throwable: Throwable) => SMono.raiseError(throwable)
+      case Left(throwable: Throwable) => SMono.error(throwable)
     }
   }
 
diff --git a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/routes/JMAPApiRoutesTest.scala b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/routes/JMAPApiRoutesTest.scala
index ab43abe..da32739 100644
--- a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/routes/JMAPApiRoutesTest.scala
+++ b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/routes/JMAPApiRoutesTest.scala
@@ -433,7 +433,7 @@ class JMAPApiRoutesTest extends AnyFlatSpec with BeforeAndAfter with Matchers {
   "RFC-8621 with random error when processing request " should "return 200, with serverFail error, others method call proceed normally" in {
     val mockCoreEchoMethod = mock(classOf[CoreEchoMethod])
 
-    doReturn(SFlux.raiseError(new RuntimeException("Unexpected Exception occur, the others method may proceed normally")))
+    doReturn(SFlux.error(new RuntimeException("Unexpected Exception occur, the others method may proceed normally")))
       .doCallRealMethod()
       .when(mockCoreEchoMethod)
       .process(any[Set[CapabilityIdentifier]], any(), any())

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org