[Advanced] Handling x-error With "IF" When Using "Open X-Callback URL"

Help

Hey all,

When invoking the "Open X-Callback URL" action from within a shortcut, is it possible to handle an error that arises from within the calling shortcut via x-error?

For example

  1. Format data to pass into URL Scheme
  2. Pass URL into "Open X-Callback URL"
  3. App with URL Scheme produces an error and returns to shortcuts with error message
  4. **I want to be able to handle the error from x-error by using an If statement

Some documentation I've already looked at

My Shorcut

https://www.icloud.com/shortcuts/c4df65503d96496687e9fd262f39d6da

I'm working on a Shortcut that will pull Github Issues and add them as tasks to Things 3.

Right now I am using "Open X-Callaback URL" to invoke the correct Things URL Scheme and passing in JSON data.

Everything works great, except when the task in Things that has been removed and cann't be found when performing update. This produces an error.

Now things will execute x-error and pass the error message back to Shortcuts. When this happens, Shortcuts renders a popup menu with the message and OK button. Can I avoid this?

How do I handle the callback error with an IF statement in Shortcuts? Otherwise, can I configure a URL Scheme to tell Shortcuts to jump directly to an action in a Shortcut

Posted Dec 7, 2018, 12:33 AM UTC

35
NikoUY•

I don’t have the Things app to test it but try adding &x-error=shortcuts://run-shortcut?name=Github%20%E2%86%92%20Things%20(shared) to the url, that should call your Shortcut again and you might get and input you can test, so if the shortcut gets no input then keep going but if you get something then you can handle it from there.

Having said that I’m not sure it’ll work without adding “&input=“ to the url but is worth to try it anyways, I know some apps support placeholders like “{{error}}” or similar for this kind of situations but I don’t know if Things use them.

2
spen-smith•

Does the reply URL have any indicative factors when it comes back? You could get text and then convert it to text from input and run an if statement to only run your program if it contains some key part of the URL.

1
spen-smith•

Does that make sense? You need to be able to determine if it was an error, which, of course. How can you do that?

1
spen-smith•

Or just use IF Input Equals X-Error, leave the section blank, and then use the Otherwise.

1
spen-smith•

It sounds possible. And I hope to help. My big picture understanding is that you’re trying to use the large function to do a specific set of tasks, but I bet you could do what the large function does on your own through seeing what X-Callback is doing. Print the input and output, and get inside the black box.

1
llabball•

I have the same issue with failing to read a file in Working Copy. It returns to Shortcuts and alerts me the the file doesn’t exists. After tabbing “Ok” the shortcut doesn’t continue.

I would like to prevent the user interaction and cancellation. Instead i would handle the missing content.

Have you found a solution?

1