-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adapt errors from Azure to specific
QueueException
- Loading branch information
Showing
6 changed files
with
60 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
azure/service-bus/src/main/scala/com/commercetools/queue/azure/servicebus/package.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.commercetools.queue.azure | ||
|
||
import com.azure.core.exception.{ResourceExistsException, ResourceNotFoundException} | ||
import com.commercetools.queue.{QueueAlreadyExistException, QueueDoesNotExistException, QueueException, UnknownQueueException} | ||
import com.commercetools.queue.CannotPushException | ||
import com.commercetools.queue.CannotPullException | ||
import com.commercetools.queue.CannotSettleException | ||
import com.commercetools.queue.Settlement | ||
|
||
package object servicebus { | ||
|
||
def makeQueueException(t: Throwable, queueName: String): QueueException = | ||
t match { | ||
case _: ResourceNotFoundException => QueueDoesNotExistException(queueName, t) | ||
case _: ResourceExistsException => QueueAlreadyExistException(queueName, t) | ||
case t: QueueException => t | ||
case _ => UnknownQueueException(queueName, t) | ||
} | ||
|
||
def makePushQueueException(t: Throwable, queueName: String): QueueException = | ||
new CannotPushException(queueName, makeQueueException(t, queueName)) | ||
|
||
def makePullQueueException(t: Throwable, queueName: String): QueueException = | ||
new CannotPullException(queueName, makeQueueException(t, queueName)) | ||
|
||
def makeSettlementException(t: Throwable, queueName: String, msgId: String, action: Settlement): QueueException = | ||
new CannotSettleException(msgId = msgId, action = action, inner = makeQueueException(t, queueName)) | ||
|
||
} |