How may I manage the "error" condition on a "URL Download" ?

Post your questions and help other users.

Moderator: Martin

Post Reply
wfrcrd
Posts: 116
Joined: 27 May 2015 08:57

How may I manage the "error" condition on a "URL Download" ?

Post by wfrcrd » 03 Jan 2019 10:42

Hi to everyone, another simple question:

I made an "URL Download" action in a do cicle, and I must stop the cicle when
the "URL Download" action goes to an error condition (for example, the file to download don't exist).
How can I intercept the error condition (in my case, if the file to download don't exist, and then stop the flow) ?
Thank you in advice!

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: How may I manage the "error" condition on a "URL Downloa

Post by Desmanto » 03 Jan 2019 17:58

Add the connection first and change the connection to exception, as shown here : viewtopic.php?f=5&t=7314#p20955
You might want to catch the error by using action Notification on Statusbar and put the error there.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

wfrcrd
Posts: 116
Joined: 27 May 2015 08:57

Re: How may I manage the "error" condition on a "URL Downloa

Post by wfrcrd » 03 Jan 2019 21:35

Thank you for the answer, I made it in a very simple way:
1) create a standard connection to the download action back to the previous cicle step, wich increments a variable and then perform the download action again
2) create an exception connection from the same download action to another action " stop flow"

so the download action continues with every new element and the first time an element miss, and the download action perform an error, the exception connection
drives to the "stop the flow" action.
It seems working, thanks a lot!

wfrcrd
Posts: 116
Joined: 27 May 2015 08:57

Re: How may I manage the "error" condition on a "URL Downloa

Post by wfrcrd » 04 Jan 2019 09:48

I confirm that this way it works,
but if I add another step (a simple script b=b+1 for ex.) after the "exception" connection,
and then an expression to check "b", it gives me an error :

" End executing condition 'Expression: b=3' with return value false and exception Could not convert value '3' to boolean "

this means that (as I suppose) I've not well understood the meaning of the "exception" connection.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: How may I manage the "error" condition on a "URL Downloa

Post by Martin » 04 Jan 2019 10:01

Comparing values in a script requires two equal signs, otherwise it's an assignment. Changing the script to b==3 should work.

Regards,
Martin

wfrcrd
Posts: 116
Joined: 27 May 2015 08:57

Re: How may I manage the "error" condition on a "URL Downloa

Post by wfrcrd » 04 Jan 2019 11:45

Oh , thank you!

(It works!)

Post Reply