ReactKit / SwiftTask

Promise + progress + pause + cancel + retry for Swift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failure return `value`

AnthonyMDev opened this issue · comments

Maybe I'm completely confused about the way this works, but shouldn't a failureClosure return Void? Currently, it's trying to return the Value type.

The README shows failure returning Void, which makes sense. Why is the failureClosure returning the value? If the task has failed, shouldn't there be no value?

I'm unable to use this, because, for the task I'm trying to create, if the task has failed, I can't return a value, since the value doesn't exist.

failureClosure is used for not only handling the future-failed error, but also you can recover it by returning a new task (or value) inside the closure.

For example:

task1.success { ...
    // this closure is called on task1 success only
    return task2
}.failure { ...
    // this closure is called on task1 failure only
    return task3
}.then { ...
    // this closure is called on either task2 or task3 success or failure
}

If task1 fails, task3 will be created as a recovery task
and its completion will be handled inside consecutive thenClosure.

If you aren't interested in failure-recovery, you can just say "no recovery task"
by returning Void inside failureClosure, as README example is doing.

That makes sense. Thank you!

Sent from my iPhone

On Jul 17, 2015, at 17:15, Yasuhiro Inami notifications@github.com wrote:

failureClosure is used for not only handling the future-failed error, but also you can recover it by returning a new task (or value) inside the closure.

For example:

task1.success { ...
// this closure is called on task1 success only
return task2
}.failure { ...
// this closure is called on task1 failure only
return task3
}.then { ...
// this closure is called on either task2 or task3 success or failure
}
If task1 fails, task3 will be created as a recovery task
and its completion will be handled inside consecutive thenClosure.

If you aren't interested in failure-recovery, you can just say "no recovery task"
by returning Void inside failureClosure, as README example is doing.


Reply to this email directly or view it on GitHub.

#outlook a {

padding: 0;
}
.ReadMsgBody {

width: 100%;
}
.ExternalClass {

width: 100%;
}
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {

line-height: 100%;
}
body, table, td, a {

-webkit-text-size-adjust: 100%;

-ms-text-size-adjust: 100%;
}
table, td {

mso-table-lspace: 0pt;

mso-table-rspace: 0pt;
}
img {

-ms-interpolation-mode: bicubic;
}

body {

margin: 0;

padding: 0;

}
img {

border: 0;

height: auto;

line-height: 100%;

outline: none;

text-decoration: none;
}
table {

border-collapse: collapse !important;
}
body {

height: 100% !important;

margin: 0;

padding: 0;

width: 100% !important;
}

appleBody a {

color: #68440a;

text-decoration: none;
}
.appleFooter a {

color: #999999;

text-decoration: none;
}
.faq {

line-height: 18px;

list-style: outside none none;

margin: 10px 0;

padding: 0;
}
.mobile-only {

display: none;
}

@media screen and (max-width: 525px) {

table[class="wrapper"] {

width: 100% !important;
}

td[class="logo"] {

text-align: left;

padding: 20px 0 20px 0 !important;
}
td[class="logo"] img {

margin: 0 auto!important;
}

[class="mobile-only"] {

display: block;
}

br[class="mobile-hide"] {

display: none;
}
td[class="mobile-hide"] {

display: none;
}
img[class="mobile-hide"] {

display: none !important;
}
img[class="img-max"] {

max-width: 100% !important;

width: 100% !important;

height: auto !important;
}

img[class="img-min"] {

max-width: 73px !important;

width: 73px !important;

height: auto !important;

padding-top: 8px !important;
}

img[class="img-apps"] {

max-width: 46% !important;

width: 46% !important;

height: auto !important;
}
img[class="img-max-profile"] {

max-width: 50% !important;

width: 50% !important;

height: auto !important;

border-radius: 200px;
}

table[class="responsive-table"] {

width: 100%!important;
}

td[class="padding"] {

padding: 10px 5% 15px 5% !important;
}
td[class="amount"] {

font-size: 10px!important;
}
td[class="mobile-text-twelve"] {

font-size: 12px!important;
}
span[class="mobile-text-twelve"] {

font-size: 14px!important;
}
td[class="padding-copy"] {

padding: 10px 5% 10px 5% !important;

text-align: center;
}
td[class="padding-meta"] {

padding: 30px 5% 0px 5% !important;

text-align: center;
}
td[class="no-pad"] {

padding: 0 0 20px 0 !important;
}
td[class="no-pad-bottom"] {

padding: 25px 0 0 0 !important;
}
td[class="no-padding"] {

padding: 0 !important;
}
td[class="section-padding"] {

padding: 25px 15px 25px 15px !important;
}
td[class="section-no-padding-bottom"] {

padding: 25px 15px 0 15px !important;
}

td[class="section-no-padding-top"] {

padding: 0 5% 25px 5% !important;
}

td[class="section-no-padding-top-bottom"] {

padding: 0 5% 0 5% !important;
}
td[class="section-padding-bottom-image"] {

padding: 50px 15px 0 15px !important;
}

td[class="mobile-wrapper"] {

padding: 10px 5% 15px 5% !important;
}
table[class="mobile-button-container"] {

margin: 0 auto;

width: 100% !important;
}
a[class="mobile-button"] {

width: 80% !important;

padding: 15px !important;

border: 0 !important;

font-size: 16px !important;
}
}

You've been officially invited to anthony.miller.csn@gmail.com's circle of trust.

Accept your invitation ►

Don't know anthony.miller.csn@gmail.com? View their photos or see who else you know in their circle of trust before accepting.

*This offer has been sent by anthony.miller.csn@gmail.com. By accepting this offer to try the new empowr, I stipulate that I'm 18 or older and am signing up having agreed with the product, terms and privacy policies, including the manner in which "$" and the word "earnings" are used throughout the empowr website, mobile apps and all empowr communications including this email, as defined in the product policy. This promotional email was sent to reply@reply.github.com and may contain special notices or offers. It is for illustrative purposes only and is in no way a guarantee. You can prevent future emails here. empowr - 501 West Broadway, Suite A182, San Diego, CA 92101, USA.

#outlook a {

padding: 0;
}
ReadMsgBody {

width: 100%;
}
ExternalClass {

width: 100%;
}
ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {

line-height: 100%;
}
body, table, td, a {

-webkit-text-size-adjust: 100%;

-ms-text-size-adjust: 100%;
}
table, td {

mso-table-lspace: 0pt;

mso-table-rspace: 0pt;
}
img {

-ms-interpolation-mode: bicubic;
}

body {

margin: 0;

padding: 0;

}
img {

border: 0;

height: auto;

line-height: 100%;

outline: none;

text-decoration: none;
}
table {

border-collapse: collapse !important;
}
body {

height: 100% !important;

margin: 0;

padding: 0;

width: 100% !important;
}

appleBody a {

color: #68440a;

text-decoration: none;
}
appleFooter a {

color: #999999;

text-decoration: none;
}
faq {

line-height: 18px;

list-style: outside none none;

margin: 10px 0;

padding: 0;
}
mobile-only {

display: none;
}

@media screen and (max-width: 525px) {

table[class="wrapper"] {

width: 100% !important;
}

td[class="logo"] {

text-align: left;

padding: 20px 0 20px 0 !important;
}
td[class="logo"] img {

margin: 0 auto!important;
}

[class="mobile-only"] {

display: block;
}

br[class="mobile-hide"] {

display: none;
}
td[class="mobile-hide"] {

display: none;
}
img[class="mobile-hide"] {

display: none !important;
}
img[class="img-max"] {

max-width: 100% !important;

width: 100% !important;

height: auto !important;
}

img[class="img-min"] {

max-width: 73px !important;

width: 73px !important;

height: auto !important;

padding-top: 8px !important;
}

img[class="img-apps"] {

max-width: 46% !important;

width: 46% !important;

height: auto !important;
}
img[class="img-max-profile"] {

max-width: 50% !important;

width: 50% !important;

height: auto !important;

border-radius: 200px;
}

table[class="responsive-table"] {

width: 100%!important;
}

td[class="padding"] {

padding: 10px 5% 15px 5% !important;
}
td[class="amount"] {

font-size: 10px!important;
}
td[class="mobile-text-twelve"] {

font-size: 12px!important;
}
span[class="mobile-text-twelve"] {

font-size: 14px!important;
}
td[class="padding-copy"] {

padding: 10px 5% 10px 5% !important;

text-align: center;
}
td[class="padding-meta"] {

padding: 30px 5% 0px 5% !important;

text-align: center;
}
td[class="no-pad"] {

padding: 0 0 20px 0 !important;
}
td[class="no-pad-bottom"] {

padding: 25px 0 0 0 !important;
}
td[class="no-padding"] {

padding: 0 !important;
}
td[class="section-padding"] {

padding: 25px 15px 25px 15px !important;
}
td[class="section-no-padding-bottom"] {

padding: 25px 15px 0 15px !important;
}

td[class="section-no-padding-top"] {

padding: 0 5% 25px 5% !important;
}

td[class="section-no-padding-top-bottom"] {

padding: 0 5% 0 5% !important;
}
td[class="section-padding-bottom-image"] {

padding: 50px 15px 0 15px !important;
}

td[class="mobile-wrapper"] {

padding: 10px 5% 15px 5% !important;
}
table[class="mobile-button-container"] {

margin: 0 auto;

width: 100% !important;
}
a[class="mobile-button"] {

width: 80% !important;

padding: 15px !important;

border: 0 !important;

font-size: 16px !important;
}
}

anthony.miller.csn@gmail.com sent you $20 to try the all-new empowr:

Receive your $20 ►

Resources:

What is empowr?
Who's behind it?
See who you know that's on empowr

No more emails from anthony.miller.csn@gmail.com (anthony.miller.csn@gmail.com)? Unsubscribe
http://profile.empowr.com/ApplicationManager/CommunityEmailSettings.aspx?em=K%2FzdUVCDppRybzAPzsRVnVM1SlTHIDB1cKJOWhWM3g2So13TJKDIZSFZ3HVCIXM4rqoIi%2FhvCa4hsONOWJe%2BtxPM7APbvkQ2txqo6vugkayUxyXy8HwnTF%2Fq5LAsaZnvpndv%2Blr711Q6vo%2FlwnmrMzCTwT%2FeVZdv&vet=694&mlid=8998720686&fn=QpLpyL23t7HpRXkzIHngtg%3D%3D

*This offer has been sent by anthony.miller.csn@gmail.com. By accepting this offer to try the new empowr, I stipulate that I'm 18 or older and am signing up having agreed with the product, terms and privacy policies, including the manner in which "$" and the word "earnings" are used throughout the empowr website, mobile apps and all empowr communications including this email, as defined in the product policy. This promotional email was sent to reply@reply.github.com and may contain special notices or offers. It is for illustrative purposes only and is in no way a guarantee. You can prevent future emails here. empowr - 501 West Broadway, Suite A182, San Diego, CA 92101, USA.

#outlook a {

padding: 0;
}
ReadMsgBody {

width: 100%;
}
ExternalClass {

width: 100%;
}
ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {

line-height: 100%;
}
body, table, td, a {

-webkit-text-size-adjust: 100%;

-ms-text-size-adjust: 100%;
}
table, td {

mso-table-lspace: 0pt;

mso-table-rspace: 0pt;
}
img {

-ms-interpolation-mode: bicubic;
}

body {

margin: 0;

padding: 0;

}
img {

border: 0;

height: auto;

line-height: 100%;

outline: none;

text-decoration: none;
}
table {

border-collapse: collapse !important;
}
body {

height: 100% !important;

margin: 0;

padding: 0;

width: 100% !important;
}

appleBody a {

color: #68440a;

text-decoration: none;
}
appleFooter a {

color: #999999;

text-decoration: none;
}
faq {

line-height: 18px;

list-style: outside none none;

margin: 10px 0;

padding: 0;
}
mobile-only {

display: none;
}

@media screen and (max-width: 525px) {

table[class="wrapper"] {

width: 100% !important;
}

td[class="logo"] {

text-align: left;

padding: 20px 0 20px 0 !important;
}
td[class="logo"] img {

margin: 0 auto!important;
}

[class="mobile-only"] {

display: block;
}

br[class="mobile-hide"] {

display: none;
}
td[class="mobile-hide"] {

display: none;
}
img[class="mobile-hide"] {

display: none !important;
}
img[class="img-max"] {

max-width: 100% !important;

width: 100% !important;

height: auto !important;
}

img[class="img-min"] {

max-width: 73px !important;

width: 73px !important;

height: auto !important;

padding-top: 8px !important;
}

img[class="img-apps"] {

max-width: 46% !important;

width: 46% !important;

height: auto !important;
}
img[class="img-max-profile"] {

max-width: 50% !important;

width: 50% !important;

height: auto !important;

border-radius: 200px;
}

table[class="responsive-table"] {

width: 100%!important;
}

td[class="padding"] {

padding: 10px 5% 15px 5% !important;
}
td[class="amount"] {

font-size: 10px!important;
}
td[class="mobile-text-twelve"] {

font-size: 12px!important;
}
span[class="mobile-text-twelve"] {

font-size: 14px!important;
}
td[class="padding-copy"] {

padding: 10px 5% 10px 5% !important;

text-align: center;
}
td[class="padding-meta"] {

padding: 30px 5% 0px 5% !important;

text-align: center;
}
td[class="no-pad"] {

padding: 0 0 20px 0 !important;
}
td[class="no-pad-bottom"] {

padding: 25px 0 0 0 !important;
}
td[class="no-padding"] {

padding: 0 !important;
}
td[class="section-padding"] {

padding: 25px 15px 25px 15px !important;
}
td[class="section-no-padding-bottom"] {

padding: 25px 15px 0 15px !important;
}

td[class="section-no-padding-top"] {

padding: 0 5% 25px 5% !important;
}

td[class="section-no-padding-top-bottom"] {

padding: 0 5% 0 5% !important;
}
td[class="section-padding-bottom-image"] {

padding: 50px 15px 0 15px !important;
}

td[class="mobile-wrapper"] {

padding: 10px 5% 15px 5% !important;
}
table[class="mobile-button-container"] {

margin: 0 auto;

width: 100% !important;
}
a[class="mobile-button"] {

width: 80% !important;

padding: 15px !important;

border: 0 !important;

font-size: 16px !important;
}
}

Yesterday, anthony.miller.csn@gmail.com sent you $20 to try the all-new empowr:

Receive your $20 ►

Not sure you know anthony.miller.csn@gmail.com?

View their photos to see if you recognize them

Resources:

What is empowr?
Who's behind it?
See who you know that's on empowr

No more emails from anthony.miller.csn@gmail.com (anthony.miller.csn@gmail.com)? Unsubscribe
http://profile.empowr.com/ApplicationManager/CommunityEmailSettings.aspx?em=K%2FzdUVCDppRybzAPzsRVnVM1SlTHIDB1cKJOWhWM3g2So13TJKDIZSFZ3HVCIXM4rqoIi%2FhvCa4hsONOWJe%2BtxPM7APbvkQ2txqo6vugkayUxyXy8HwnTF%2Fq5LAsaZnvpndv%2Blr711Q6vo%2FlwnmrMzCTwT%2FeVZdv&vet=694&mlid=9006704656&fn=QpLpyL23t7HpRXkzIHngtg%3D%3D

*This offer has been sent by anthony.miller.csn@gmail.com. By accepting this offer to try the new empowr, I stipulate that I'm 18 or older and am signing up having agreed with the product, terms and privacy policies, including the manner in which "$" and the word "earnings" are used throughout the empowr website, mobile apps and all empowr communications including this email, as defined in the product policy. This promotional email was sent to reply@reply.github.com and may contain special notices or offers. It is for illustrative purposes only and is in no way a guarantee. You can prevent future emails here. empowr - 501 West Broadway, Suite A182, San Diego, CA 92101, USA.

#outlook a {

padding: 0;
}
.ReadMsgBody {

width: 100%;
}
.ExternalClass {

width: 100%;
}
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {

line-height: 100%;
}
body, table, td, a {

-webkit-text-size-adjust: 100%;

-ms-text-size-adjust: 100%;
}
table, td {

mso-table-lspace: 0pt;

mso-table-rspace: 0pt;
}
img {

-ms-interpolation-mode: bicubic;
}

body {

margin: 0;

padding: 0;

}
img {

border: 0;

height: auto;

line-height: 100%;

outline: none;

text-decoration: none;
}
table {

border-collapse: collapse !important;
}
body {

height: 100% !important;

margin: 0;

padding: 0;

width: 100% !important;
}

appleBody a {

color: #68440a;

text-decoration: none;
}
.appleFooter a {

color: #999999;

text-decoration: none;
}
.faq {

line-height: 18px;

list-style: outside none none;

margin: 10px 0;

padding: 0;
}
.mobile-only {

display: none;
}

@media screen and (max-width: 525px) {

table[class="wrapper"] {

width: 100% !important;
}

td[class="logo"] {

text-align: left;

padding: 20px 0 20px 0 !important;
}
td[class="logo"] img {

margin: 0 auto!important;
}

[class="mobile-only"] {

display: block;
}

br[class="mobile-hide"] {

display: none;
}
td[class="mobile-hide"] {

display: none;
}
img[class="mobile-hide"] {

display: none !important;
}
img[class="img-max"] {

max-width: 100% !important;

width: 100% !important;

height: auto !important;
}

img[class="img-min"] {

max-width: 73px !important;

width: 73px !important;

height: auto !important;

padding-top: 8px !important;
}

img[class="img-apps"] {

max-width: 46% !important;

width: 46% !important;

height: auto !important;
}
img[class="img-max-profile"] {

max-width: 50% !important;

width: 50% !important;

height: auto !important;

border-radius: 200px;
}

table[class="responsive-table"] {

width: 100%!important;
}

td[class="padding"] {

padding: 10px 5% 15px 5% !important;
}
td[class="amount"] {

font-size: 10px!important;
}
td[class="mobile-text-twelve"] {

font-size: 12px!important;
}
span[class="mobile-text-twelve"] {

font-size: 14px!important;
}
td[class="padding-copy"] {

padding: 10px 5% 10px 5% !important;

text-align: center;
}
td[class="padding-meta"] {

padding: 30px 5% 0px 5% !important;

text-align: center;
}
td[class="no-pad"] {

padding: 0 0 20px 0 !important;
}
td[class="no-pad-bottom"] {

padding: 25px 0 0 0 !important;
}
td[class="no-padding"] {

padding: 0 !important;
}
td[class="section-padding"] {

padding: 25px 15px 25px 15px !important;
}
td[class="section-no-padding-bottom"] {

padding: 25px 15px 0 15px !important;
}

td[class="section-no-padding-top"] {

padding: 0 5% 25px 5% !important;
}

td[class="section-no-padding-top-bottom"] {

padding: 0 5% 0 5% !important;
}
td[class="section-padding-bottom-image"] {

padding: 50px 15px 0 15px !important;
}

td[class="mobile-wrapper"] {

padding: 10px 5% 15px 5% !important;
}
table[class="mobile-button-container"] {

margin: 0 auto;

width: 100% !important;
}
a[class="mobile-button"] {

width: 80% !important;

padding: 15px !important;

border: 0 !important;

font-size: 16px !important;
}
}

Just a friendly reminder that anthony.miller.csn@gmail.com sent you $20 to try the all-new empowr:

Receive your $20 ►

Don't know anthony.miller.csn@gmail.com?

Return the $20 so it doesn't go to waste and you're not keeping anthony.miller.csn@gmail.com waiting

Resources:

What is empowr?
Who's behind it?
See who you know that's on empowr

No more emails from anthony.miller.csn@gmail.com (anthony.miller.csn@gmail.com)? Unsubscribe
http://profile.empowr.com/ApplicationManager/CommunityEmailSettings.aspx?em=K%2FzdUVCDppRybzAPzsRVnVM1SlTHIDB1cKJOWhWM3g2So13TJKDIZSFZ3HVCIXM4rqoIi%2FhvCa4hsONOWJe%2BtxPM7APbvkQ2txqo6vugkayUxyXy8HwnTF%2Fq5LAsaZnvpndv%2Blr711Q6vo%2FlwnmrMzCTwT%2FeVZdv&vet=694&mlid=9014935159&fn=QpLpyL23t7HpRXkzIHngtg%3D%3D

*This offer has been sent by anthony.miller.csn@gmail.com. By accepting this offer to try the new empowr, I stipulate that I'm 18 or older and am signing up having agreed with the product, terms and privacy policies, including the manner in which "$" and the word "earnings" are used throughout the empowr website, mobile apps and all empowr communications including this email, as defined in the product policy. This promotional email was sent to reply@reply.github.com and may contain special notices or offers. It is for illustrative purposes only and is in no way a guarantee. You can prevent future emails here. empowr - 501 West Broadway, Suite A182, San Diego, CA 92101, USA.