Skip to content

Commit

Permalink
Avoid re-wrapping QueueExceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
satabin committed Apr 5, 2024
1 parent 5368344 commit 44acbb6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,15 @@ package object sqs {
new CannotPushException(queueName, makeQueueException(t, queueName))

def makePullQueueException(t: Throwable, queueName: String): QueueException =
new CannotPullException(queueName, makeQueueException(t, queueName))
t match {
case t: QueueException => t
case _ => new CannotPullException(queueName, makeQueueException(t, queueName))
}

def makeMessageException(t: Throwable, queueName: String, msgId: String, action: Action): QueueException =
new MessageException(msgId = msgId, action = action, inner = makeQueueException(t, queueName))
t match {
case t: QueueException => t
case _ => new MessageException(msgId = msgId, action = action, inner = makeQueueException(t, queueName))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,15 @@ package object servicebus {
new CannotPushException(queueName, makeQueueException(t, queueName))

def makePullQueueException(t: Throwable, queueName: String): QueueException =
new CannotPullException(queueName, makeQueueException(t, queueName))
t match {
case t: QueueException => t
case _ => new CannotPullException(queueName, makeQueueException(t, queueName))
}

def makeMessageException(t: Throwable, queueName: String, msgId: String, action: Action): QueueException =
new MessageException(msgId = msgId, action = action, inner = makeQueueException(t, queueName))
t match {
case t: QueueException => t
case _ => new MessageException(msgId = msgId, action = action, inner = makeQueueException(t, queueName))
}

}

0 comments on commit 44acbb6

Please sign in to comment.