Or, just always :return something in the in= block... That seems to be the implied requirement...whether that's a bug or just undocumented is better left to Mikrotik. Did you report this to support@mikrotik.com?
One thing I noticed in your examples is using # comments in the in= block... That may actually be CAUSING the error condition (thus the do= block to run). At the CLI at least comment are not allowed inline like that... perhaps it's enforced in other contexts for :onerror, dunno?
The docs describe using :onerror in a :if statement and suggest :onerror itself returns a True or False value... so there are few things going on inside :onerror involving the call stack. e.g. :set return nil ([:nothing]) while :put BOTH returns it's input and writes to the screen.
One thing I noticed in your examples is using # comments in the in= block... That may actually be CAUSING the error condition (thus the do= block to run). At the CLI at least comment are not allowed inline like that... perhaps it's enforced in other contexts for :onerror, dunno?
The docs describe using :onerror in a :if statement and suggest :onerror itself returns a True or False value... so there are few things going on inside :onerror involving the call stack. e.g. :set return nil ([:nothing]) while :put BOTH returns it's input and writes to the screen.
Code:
> :put [:typeof [:set zzz 12]] nil> :put [:typeof [:put "sometext"]] sometextstr
Statistics: Posted by Amm0 — Thu Jan 11, 2024 8:08 pm