Catch all IOExceptions in executeMethod. Closes #2
This commit is contained in:
parent
505eee98f0
commit
d3b6fb50d1
1 changed files with 20 additions and 20 deletions
|
@ -242,6 +242,7 @@ open class PinboardPoster() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun executeMethod(method: String, params: List<Pair<String, String>>): Boolean {
|
private fun executeMethod(method: String, params: List<Pair<String, String>>): Boolean {
|
||||||
|
try {
|
||||||
val apiUrl = cleanEndPoint(method).toHttpUrlOrNull()
|
val apiUrl = cleanEndPoint(method).toHttpUrlOrNull()
|
||||||
if (apiUrl != null) {
|
if (apiUrl != null) {
|
||||||
val httpUrl = apiUrl.newBuilder().apply {
|
val httpUrl = apiUrl.newBuilder().apply {
|
||||||
|
@ -259,16 +260,15 @@ open class PinboardPoster() {
|
||||||
if (response.contains("done")) {
|
if (response.contains("done")) {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
try {
|
|
||||||
parseMethodResponse(method, response)
|
parseMethodResponse(method, response)
|
||||||
} catch (e: IOException) {
|
|
||||||
logger.log(Level.SEVERE, e.message, e)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.severe("Invalid API end point: $apiEndPoint")
|
logger.severe("Invalid API end point: $apiEndPoint")
|
||||||
}
|
}
|
||||||
|
} catch (e: IOException) {
|
||||||
|
logger.log(Level.SEVERE, e.message, e)
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue