[SOLVED] processing External handler exceptions

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dbm
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.

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: processing External handler exceptions

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

Hi,

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

You can check for it in the dictionary.

Regards,

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

dbm
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”