Community discussions

MikroTik App
 
pxcorp
just joined
Topic Author
Posts: 11
Joined: Thu Jun 15, 2017 7:48 pm

error handling with /import

Tue May 10, 2022 8:19 am

Hello I am importing script from another script. Import itself working but I woul like to add some error handling. So I tried:
:do {
/import file-name="somescript.rsc"
}  on-error={
:log warning "script failed"
}
But this way it work only when import command failed itself (imported file not exist). But if imported script produce any error, it is not catched, instead processing is imediately terminated (including parent script). Is there any way (other than background running thru :execute - which is not much suitable for my use due to its asynchronous behavior) to catch imported script errors?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: error handling with /import

Tue May 10, 2022 10:28 am

put the ckecks inside the imported script...

Who is online

Users browsing this forum: GoogleOther [Bot], marcelofares, rogerioqueiroz and 26 guests