mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55: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:
@@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user