@@ -86,7 +86,7 @@ public function __construct(SqsClient $client, $name, array $options = [])
8686 public function acknowledge (array $ messages )
8787 {
8888 $ url = $ this ->getQueueUrl ();
89- $ failed = [];
89+ $ errors = [];
9090 $ batches = array_chunk ($ this ->createDeleteEntries ($ messages ), self ::BATCHSIZE_DELETE );
9191
9292 foreach ($ batches as $ batch ) {
@@ -95,15 +95,15 @@ public function acknowledge(array $messages)
9595 'Entries ' => $ batch ,
9696 ]);
9797
98- $ map = function ($ result ) use ($ messages ) {
99- return $ messages [$ result ['Id ' ]];
100- };
101-
102- $ failed = array_merge ($ failed , array_map ($ map , $ results ->get ('Failed ' ) ?: []));
98+ $ errors = array_merge ($ errors , $ results ->get ('Failed ' ) ?: []);
10399 }
100+ $ map = function ($ result ) use ($ messages ) {
101+ return $ messages [$ result ['Id ' ]];
102+ };
103+ $ failed = array_map ($ map , $ errors );
104104
105105 if (!empty ($ failed )) {
106- throw new FailedAcknowledgementException ($ this , $ failed );
106+ throw new FailedAcknowledgementException ($ this , $ failed, $ errors );
107107 }
108108 }
109109
@@ -115,7 +115,7 @@ public function acknowledge(array $messages)
115115 public function reject (array $ messages )
116116 {
117117 $ url = $ this ->getQueueUrl ();
118- $ failed = [];
118+ $ errors = [];
119119 $ batches = array_chunk ($ this ->createRejectEntries ($ messages ), self ::BATCHSIZE_DELETE );
120120
121121 foreach ($ batches as $ batch ) {
@@ -124,15 +124,15 @@ public function reject(array $messages)
124124 'Entries ' => $ batch ,
125125 ]);
126126
127- $ map = function ($ result ) use ($ messages ) {
128- return $ messages [$ result ['Id ' ]];
129- };
130-
131- $ failed = array_merge ($ failed , array_map ($ map , $ results ->get ('Failed ' ) ?: []));
127+ $ errors = array_merge ($ errors , $ results ->get ('Failed ' ) ?: []);
132128 }
129+ $ map = function ($ result ) use ($ messages ) {
130+ return $ messages [$ result ['Id ' ]];
131+ };
132+ $ failed = array_map ($ map , $ errors );
133133
134134 if (!empty ($ failed )) {
135- throw new FailedAcknowledgementException ($ this , $ failed );
135+ throw new FailedAcknowledgementException ($ this , $ failed, $ errors );
136136 }
137137 }
138138
@@ -193,7 +193,7 @@ public function dequeue(MessageFactoryInterface $factory, $limit)
193193 public function enqueue (array $ messages )
194194 {
195195 $ url = $ this ->getQueueUrl ();
196- $ failed = [];
196+ $ errors = [];
197197 $ batches = array_chunk ($ this ->createEnqueueEntries ($ messages ), self ::BATCHSIZE_SEND );
198198
199199 foreach ($ batches as $ batch ) {
@@ -202,15 +202,15 @@ public function enqueue(array $messages)
202202 'Entries ' => $ batch ,
203203 ]);
204204
205- $ map = function ($ result ) use ($ messages ) {
206- return $ messages [$ result ['Id ' ]];
207- };
208-
209- $ failed = array_merge ($ failed , array_map ($ map , $ results ->get ('Failed ' ) ?: []));
205+ $ errors = array_merge ($ errors , $ results ->get ('Failed ' ) ?: []);
210206 }
207+ $ map = function ($ result ) use ($ messages ) {
208+ return $ messages [$ result ['Id ' ]];
209+ };
210+ $ failed = array_map ($ map , $ errors );
211211
212212 if (!empty ($ failed )) {
213- throw new FailedEnqueueException ($ this , $ failed );
213+ throw new FailedEnqueueException ($ this , $ failed, $ errors );
214214 }
215215 }
216216
0 commit comments