vttranlina commented on code in PR #1275:
URL: https://github.com/apache/james-project/pull/1275#discussion_r1009140042


##########
server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailGetMethod.scala:
##########
@@ -92,10 +92,8 @@ class EmailGetMethod @Inject() (readerFactory: 
EmailViewReaderFactory,
   }
 
   override def getRequest(mailboxSession: MailboxSession, invocation: 
Invocation): Either[IllegalArgumentException, EmailGetRequest] =
-    EmailGetSerializer.deserializeEmailGetRequest(invocation.arguments.value) 
match {
-      case JsSuccess(emailGetRequest, _) => Right(emailGetRequest)
-      case errors: JsError => Left(new 
IllegalArgumentException(ResponseSerializer.serialize(errors).toString))
-    }
+    EmailGetSerializer.deserializeEmailGetRequest(invocation.arguments.value)
+      .asEither.left.map(ResponseSerializer.asException)

Review Comment:
   yes, it is not necessary, when I deserialize a request, I realize a common 
code is re-used a lot, and it is a bit verbose, so I conveniently cleaned it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to