aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-02-24 22:05:43 +0100
committerGravatar Christian Hesse <mail@eworm.de>2021-02-24 22:54:43 +0100
commit274af988865accdae914e3645ea23bae8d8c425d (patch)
treeccae6f9cc882a98255e55434f8452a26cb9d189d /global-functions
parenteaeda375e27c9909cb49913ef26d9984d541c637 (diff)
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.
Diffstat (limited to 'global-functions')
-rw-r--r--global-functions7
1 files changed, 7 insertions, 0 deletions
diff --git a/global-functions b/global-functions
index 79e0ea6..7425273 100644
--- a/global-functions
+++ b/global-functions
@@ -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";
}
}