mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-05 03:07:27 +08:00
[F] Ignore geoip not found error
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package icu.samnyan.aqua.net.utils
|
||||
|
||||
import com.maxmind.geoip2.DatabaseReader
|
||||
import com.maxmind.geoip2.exception.AddressNotFoundException
|
||||
import ext.Bool
|
||||
import ext.Str
|
||||
import jakarta.annotation.PostConstruct
|
||||
@@ -78,7 +79,9 @@ class GeoIP(
|
||||
return try {
|
||||
val ipa = InetAddress.getByName(ip)
|
||||
geoLite.country(ipa)?.country?.isoCode ?: ""
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
catch (e: AddressNotFoundException) { "" }
|
||||
catch (e: Exception) {
|
||||
log.error("Failed to get country from IP $ip", e)
|
||||
""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user