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
The following commit(s) were added to refs/heads/master by this push: new a77e1168cc [ENHANCEMENT] Log http error code upon unexpected exception calling p… (#2711) a77e1168cc is described below commit a77e1168ccba2d6c2b3a49b2dd941e9f02dd8b35 Author: Benoit TELLIER <btell...@linagora.com> AuthorDate: Thu May 15 11:38:11 2025 +0200 [ENHANCEMENT] Log http error code upon unexpected exception calling p… (#2711) --- .../jmap/rfc8621/contract/PushSubscriptionSetMethodContract.scala | 2 +- .../org/apache/james/jmap/pushsubscription/WebPushClient.scala | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/PushSubscriptionSetMethodContract.scala b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/PushSubscriptionSetMethodContract.scala index d0f706ebd7..053d2fbf28 100644 --- a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/PushSubscriptionSetMethodContract.scala +++ b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/PushSubscriptionSetMethodContract.scala @@ -2373,7 +2373,7 @@ trait PushSubscriptionSetMethodContract { | "notCreated": { | "4f29": { | "type": "serverFail", - | "description": "Error when call to Push Server. " + | "description": "Error when call to Push Server: code 500. " | } | } | }, diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/pushsubscription/WebPushClient.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/pushsubscription/WebPushClient.scala index 51e487c7bb..5ad1300ad5 100644 --- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/pushsubscription/WebPushClient.scala +++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/pushsubscription/WebPushClient.scala @@ -65,9 +65,9 @@ object WebPushClientHeader { sealed abstract class WebPushException(message: String) extends RuntimeException(message) -case class WebPushInvalidRequestException(detailError: String) extends WebPushException(s"Bad request when call to Push Server. ${detailError}") +case class WebPushInvalidRequestException(detailError: String) extends WebPushException(s"Bad request when call to Push Server. $detailError") -case class WebPushTemporarilyUnavailableException(detailError: String) extends WebPushException(s"Error when call to Push Server. ${detailError}") +case class WebPushTemporarilyUnavailableException(httpCode: Int, detailError: String) extends WebPushException(s"Error when call to Push Server: code $httpCode. $detailError") object DefaultWebPushClient { val PUSH_SERVER_ERROR_RESPONSE_MAX_LENGTH: Int = 1024 @@ -131,8 +131,8 @@ class DefaultWebPushClient @Inject()(configuration: PushClientConfiguration) ext case HttpResponseStatus.CREATED => Mono.empty() case HttpResponseStatus.BAD_REQUEST => preProcessingData(dataBuf) .flatMap(string => Mono.error(WebPushInvalidRequestException(string))) - case _ => preProcessingData(dataBuf) - .flatMap(string => Mono.error(WebPushTemporarilyUnavailableException(string))) + case statusCode: HttpResponseStatus => preProcessingData(dataBuf) + .flatMap(string => Mono.error(WebPushTemporarilyUnavailableException(statusCode.code, string))) }.`then`() private def preProcessingData(dataBuf: ByteBufMono): Mono[String] = --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org