[SOLVED] processing External handler exceptions

Interested adding externals/plugins from LiveCode and third parties to your LiveCode projects? This is the place to talk about them.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
Posts: 21
Joined: Tue Feb 17, 2015 1:12 pm

[SOLVED] processing External handler exceptions

Post by dbm » Wed Feb 25, 2015 9:58 am

I'm using the external ssh.

I've created a function that tries to connect to an ssh server (code below). The login/password are typed by the user in a card and my idea was to validate the login/password to answer if they were correct or not.
If the login/password are correct, the ssh_userauth_password returns "OK" but if intentionaly I type an incorrect user or password i get

execution error at line n/a (External handler: exception) near "Authentication failed"

I was expecting a ssh_userauth_password return similar to a negative answer "no OK" or something like this, but not a external handler exception.

Has Livecode a way to process the external handler exceptions or is it the expected behavior?

Code: Select all

function test_ssh_login sshuser sshpass sshost ssport
  local outVar, ssh_stat, ssh_session
  put ssh_new() into ssh_session
  ssh_options_set ssh_session, "host", sshost
  ssh_options_set ssh_session, "port", ssport
  ssh_connect ssh_session
  put ssh_userauth_password(ssh_session, sshuser, sshpass) into ssh_stat
  ssh_disconnect ssh_session
  ssh_free ssh_session
  return ssh_stat
end test_ssh_login
Last edited by dbm on Wed Feb 25, 2015 12:40 pm, edited 1 time in total.

VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 583
Joined: Wed Nov 22, 2006 3:42 pm
Location: France

Re: processing External handler exceptions

Post by Thierry » Wed Feb 25, 2015 10:24 am


Might be that you are looking for the try control structure?

You can check for it in the dictionary.


Thierry Douez - https://sunny-tdz.com
Pourquoi tant de notes lorsqu'il suffit de jouer les plus belles... [Barbara]

Posts: 21
Joined: Tue Feb 17, 2015 1:12 pm

Re: processing External handler exceptions

Post by dbm » Wed Feb 25, 2015 10:50 am

Exactly what I need.

The problem learning a new language is that you don't know what to search :D

Thanks for pointing me in the right direction

Post Reply

Return to “Using Externals and Plugins”