Community discussions

MikroTik App
 
f31n
just joined
Topic Author
Posts: 12
Joined: Fri Nov 15, 2019 3:59 am

Error handling

Mon May 31, 2021 12:40 pm

Hi there,
I might just miss it out but is it possible to log an error of a command when scripting?

for example i just wrote an FTP upload script for my configs and would love to get the info of "/tool fetch [..]" why its not doing shit (in my case when running the command in the cli: status: failed failure: connection failed) which would be awesome to know so i don't need to look into that script further but can easily check the connection (a closed port in my case ^^)

Am i just missing out here something or is that simply not possible?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Error handling

Mon May 31, 2021 6:49 pm

on standard config you can read the error on system log

Have you simply read the manual?
https://wiki.mikrotik.com/wiki/Manual:Scripting
 
f31n
just joined
Topic Author
Posts: 12
Joined: Fri Nov 15, 2019 3:59 am

Re: Error handling

Sat Jun 05, 2021 10:02 pm

what i am doing is uploading a backup via FTP with following command:
/tool fetch address=$ftpurl port=$ftpport src-path=$fname user=$ftpuser mode=ftp password=$ftppass dst-path="home/$fname" upload=yes
wherever I'm triggering that command no LOG entry is generated at all on error.
If triggered in the cli the error is displayed directly there (no route, login error, connection refused, etc)

but if i run that line in a script no error will be displayed anywhere, even tough i use the
do{
...
} on-error={
:log error "my error!"
}
syntax.
So I basically would like to catch the error I'm getting there and the system does realise that there is an error but i cannot address or log it ...
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3291
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Error handling

Sat Jun 05, 2021 10:59 pm

There are no solution for that in an MikroTik router.
 
f31n
just joined
Topic Author
Posts: 12
Joined: Fri Nov 15, 2019 3:59 am

Re: Error handling

Sun Jun 06, 2021 7:25 pm

so here is no way of fetching an error thrown by a subroutine for advanced error handling / sending emails pushing notifications. thats a pity, i guess i should add that to the feature request list.

thanks for your help!

Who is online

Users browsing this forum: No registered users and 21 guests