@@ -219,43 +219,34 @@ private function handleThen(ThenChain $then):bool {
219219
220220 private function handleFinally (FinallyChain $ finally ):bool {
221221 if ($ this ->getState () === PromiseState::RESOLVED ) {
222- try {
223- $ result = $ finally ->callOnResolved ($ this ->resolvedValue );
224- if ($ result instanceof PromiseInterface) {
225- $ this ->chainPromise ($ result );
226- }
227- elseif (is_null ($ result )) {
228- $ this ->stopChain = true ;
229- return true ;
230- }
231- else {
232- $ this ->resolvedValue = $ result ;
233- $ this ->resolvedValueSet = true ;
234- $ this ->tryComplete ();
235- }
222+ $ result = $ finally ->callOnResolved ($ this ->resolvedValue );
223+ if ($ result instanceof PromiseInterface) {
224+ $ this ->chainPromise ($ result );
236225 }
237- catch (Throwable $ reason ) {
238- $ this ->reject ($ reason );
226+ elseif (is_null ($ result )) {
227+ $ this ->stopChain = true ;
228+ return true ;
239229 }
230+ else {
231+ $ this ->resolvedValue = $ result ;
232+ $ this ->resolvedValueSet = true ;
233+ $ this ->tryComplete ();
234+ }
235+
240236 }
241237 elseif ($ this ->getState () === PromiseState::REJECTED ) {
242- try {
243- $ result = $ finally ->callOnRejected ($ this ->rejectedReason );
244- if ($ result instanceof PromiseInterface) {
245- $ this ->chainPromise ($ result );
246- }
247- elseif (is_null ($ result )) {
248- $ this ->stopChain = true ;
249- return true ;
250- }
251- else {
252- $ this ->resolvedValue = $ result ;
253- $ this ->resolvedValueSet = true ;
254- $ this ->tryComplete ();
255- }
238+ $ result = $ finally ->callOnRejected ($ this ->rejectedReason );
239+ if ($ result instanceof PromiseInterface) {
240+ $ this ->chainPromise ($ result );
256241 }
257- catch (Throwable $ reason ) {
258- $ this ->reject ($ reason );
242+ elseif (is_null ($ result )) {
243+ $ this ->stopChain = true ;
244+ return true ;
245+ }
246+ else {
247+ $ this ->resolvedValue = $ result ;
248+ $ this ->resolvedValueSet = true ;
249+ $ this ->tryComplete ();
259250 }
260251 }
261252
0 commit comments