Catch all IOExceptions in executeMethod. Closes #2

This commit is contained in:
Erik C. Thauvin 2020-08-19 16:41:45 -07:00
parent 505eee98f0
commit d3b6fb50d1

View file

@ -242,6 +242,7 @@ open class PinboardPoster() {
}
private fun executeMethod(method: String, params: List<Pair<String, String>>): Boolean {
try {
val apiUrl = cleanEndPoint(method).toHttpUrlOrNull()
if (apiUrl != null) {
val httpUrl = apiUrl.newBuilder().apply {
@ -259,16 +260,15 @@ open class PinboardPoster() {
if (response.contains("done")) {
return true
} else {
try {
parseMethodResponse(method, response)
} catch (e: IOException) {
logger.log(Level.SEVERE, e.message, e)
}
}
}
} else {
logger.severe("Invalid API end point: $apiEndPoint")
}
} catch (e: IOException) {
logger.log(Level.SEVERE, e.message, e)
}
return false
}