mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-05 21:11:35 +07:00
Fix linting warnings (#9701)
* fix: VariableNaming warnings
* fix: MatchingDeclarationName warnings
* fix: SwallowedException warnings
* fix: UseRequire warnings
* Revert "fix: MatchingDeclarationName warnings"
This reverts commit 9475af5052
.
This commit is contained in:
parent
3c76e2bc64
commit
5f8c675512
@ -183,7 +183,7 @@ class ApiV2(private val baseUrl: String) : ApiV2Wrapper(baseUrl), Disposable {
|
||||
val b: VersionResponse = r.body()
|
||||
b.version == 2
|
||||
}
|
||||
} catch (e: IllegalArgumentException) {
|
||||
} catch (_: IllegalArgumentException) {
|
||||
false
|
||||
} catch (e: Throwable) {
|
||||
Log.error("Unexpected exception calling version endpoint for '$baseUrl': $e")
|
||||
@ -204,7 +204,7 @@ class ApiV2(private val baseUrl: String) : ApiV2Wrapper(baseUrl), Disposable {
|
||||
val b: ApiErrorResponse = r.body()
|
||||
b.statusCode == ApiStatusCode.Unauthenticated
|
||||
}
|
||||
} catch (e: IllegalArgumentException) {
|
||||
} catch (_: IllegalArgumentException) {
|
||||
false
|
||||
} catch (e: Throwable) {
|
||||
Log.error("Unexpected exception calling WebSocket endpoint for '$baseUrl': $e")
|
||||
@ -339,9 +339,7 @@ class ApiV2(private val baseUrl: String) : ApiV2Wrapper(baseUrl), Disposable {
|
||||
* This function may also throw arbitrary exceptions for network failures.
|
||||
*/
|
||||
suspend fun awaitPing(size: Int = 2, timeout: Long? = null): Double? {
|
||||
if (size < 2) {
|
||||
throw IllegalArgumentException("Size too small to identify ping responses uniquely")
|
||||
}
|
||||
require(size < 2) { "Size too small to identify ping responses uniquely" }
|
||||
val body = ByteArray(size)
|
||||
Random().nextBytes(body)
|
||||
|
||||
@ -371,7 +369,7 @@ class ApiV2(private val baseUrl: String) : ApiV2Wrapper(baseUrl), Disposable {
|
||||
throw exception
|
||||
}
|
||||
}.toDouble() / 10e6
|
||||
} catch (c: ClosedReceiveChannelException) {
|
||||
} catch (_: ClosedReceiveChannelException) {
|
||||
return null
|
||||
} finally {
|
||||
synchronized(this) {
|
||||
@ -448,7 +446,7 @@ class ApiV2(private val baseUrl: String) : ApiV2Wrapper(baseUrl), Disposable {
|
||||
Concurrency.run {
|
||||
try {
|
||||
c.send((msg as WebSocketMessageWithContent).content)
|
||||
} catch (closed: ClosedSendChannelException) {
|
||||
} catch (_: ClosedSendChannelException) {
|
||||
delay(10)
|
||||
eventChannelList.remove(c)
|
||||
} catch (t: Throwable) {
|
||||
|
@ -50,7 +50,7 @@ class OnlineMultiplayerServer(
|
||||
if (result.isNotEmpty()) {
|
||||
featureSet = try {
|
||||
json().fromJson(ServerFeatureSet::class.java, result)
|
||||
} catch (ex: Exception) {
|
||||
} catch (_: Exception) {
|
||||
// The server does not support server feature set - not an error!
|
||||
ServerFeatureSet()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user