mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
global-functions: $GetMacVendor: improve error handling
The API returns 404 on unknown mac vendor... We can just catch error, but not decide whether it is connection error or unknown vendor. Try without mac address - on error we have a connection issue.
This commit is contained in:
parent
eaeda375e2
commit
274af98886
1 changed files with 7 additions and 0 deletions
|
@ -380,6 +380,13 @@
|
|||
("https://api.macvendors.com/" . [ :pick $Mac 0 8 ]) output=user as-value ]->"data");
|
||||
:return $Vendor;
|
||||
} on-error={
|
||||
:do {
|
||||
/ tool fetch check-certificate=yes-without-crl ("https://api.macvendors.com/") \
|
||||
output=none as-value;
|
||||
$LogPrintExit2 debug $0 ("The mac vendor is not known in database.") false;
|
||||
} on-error={
|
||||
$LogPrintExit2 warning $0 ("Failed getting mac vendor.") false;
|
||||
}
|
||||
:return "unknown vendor";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue