mirror of https://github.com/usbharu/Hideout.git
style: fix lint
This commit is contained in:
parent
5c8d7e8d36
commit
23c830f390
|
@ -92,7 +92,6 @@ import java.security.interfaces.RSAPrivateKey
|
|||
import java.security.interfaces.RSAPublicKey
|
||||
import java.util.*
|
||||
|
||||
|
||||
@EnableWebSecurity(debug = false)
|
||||
@Configuration
|
||||
@Suppress("FunctionMaxLength", "TooManyFunctions", "LongMethod")
|
||||
|
|
|
@ -35,4 +35,4 @@ open class ClientException : MastodonApiException {
|
|||
writableStackTrace: Boolean,
|
||||
response: MastodonApiErrorResponse<*>,
|
||||
) : super(message, cause, enableSuppression, writableStackTrace, response)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,4 +52,4 @@ abstract class MastodonApiException : RuntimeException {
|
|||
) {
|
||||
this.response = response
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,4 +18,4 @@ package dev.usbharu.hideout.mastodon.domain.exception
|
|||
|
||||
import dev.usbharu.hideout.mastodon.domain.model.MastodonApiErrorResponse
|
||||
|
||||
open class ServerException(response: MastodonApiErrorResponse<*>) : MastodonApiException(response)
|
||||
open class ServerException(response: MastodonApiErrorResponse<*>) : MastodonApiException(response)
|
||||
|
|
|
@ -21,19 +21,16 @@ import dev.usbharu.hideout.mastodon.domain.model.MastodonApiErrorResponse
|
|||
|
||||
class StatusNotFoundException : ClientException {
|
||||
|
||||
fun getTypedResponse(): MastodonApiErrorResponse<NotFoundResponse> {
|
||||
return response as MastodonApiErrorResponse<NotFoundResponse>
|
||||
}
|
||||
|
||||
constructor(response: MastodonApiErrorResponse<NotFoundResponse>) : super(response)
|
||||
|
||||
constructor(message: String?, response: MastodonApiErrorResponse<NotFoundResponse>) : super(message, response)
|
||||
constructor(message: String?, cause: Throwable?, response: MastodonApiErrorResponse<NotFoundResponse>) : super(
|
||||
message,
|
||||
cause,
|
||||
response
|
||||
)
|
||||
|
||||
constructor(cause: Throwable?, response: MastodonApiErrorResponse<NotFoundResponse>) : super(cause, response)
|
||||
|
||||
constructor(
|
||||
message: String?,
|
||||
cause: Throwable?,
|
||||
|
@ -42,14 +39,18 @@ class StatusNotFoundException : ClientException {
|
|||
response: MastodonApiErrorResponse<NotFoundResponse>,
|
||||
) : super(message, cause, enableSuppression, writableStackTrace, response)
|
||||
|
||||
fun getTypedResponse(): MastodonApiErrorResponse<NotFoundResponse> =
|
||||
response as MastodonApiErrorResponse<NotFoundResponse>
|
||||
|
||||
companion object {
|
||||
fun ofId(id: Long): StatusNotFoundException = StatusNotFoundException(
|
||||
"id: $id was not found.",
|
||||
MastodonApiErrorResponse(
|
||||
NotFoundResponse(
|
||||
"Record not found"
|
||||
), 404
|
||||
),
|
||||
404
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,4 +16,4 @@
|
|||
|
||||
package dev.usbharu.hideout.mastodon.domain.model
|
||||
|
||||
data class MastodonApiErrorResponse<R>(val response: R, val statusCode: Int)
|
||||
data class MastodonApiErrorResponse<R>(val response: R, val statusCode: Int)
|
||||
|
|
|
@ -85,7 +85,7 @@ class MastodonApiControllerAdvice {
|
|||
}
|
||||
|
||||
val message = details.map {
|
||||
it.key + " " + it.value.joinToString { it.description }
|
||||
it.key + " " + it.value.joinToString { responseDetails -> responseDetails.description }
|
||||
}.joinToString()
|
||||
|
||||
return ResponseEntity.unprocessableEntity()
|
||||
|
@ -101,4 +101,4 @@ class MastodonApiControllerAdvice {
|
|||
companion object {
|
||||
private val logger = LoggerFactory.getLogger(MastodonApiControllerAdvice::class.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ class MastodonStatusesApiContoller(
|
|||
)
|
||||
}
|
||||
|
||||
|
||||
override suspend fun apiV1StatusesIdEmojiReactionsEmojiDelete(id: String, emoji: String): ResponseEntity<Status> {
|
||||
val uid =
|
||||
loginUserContextHolder.getLoginUserId()
|
||||
|
|
|
@ -161,8 +161,6 @@ class StatsesApiServiceImpl(
|
|||
status: Status,
|
||||
userId: Long?,
|
||||
): Status {
|
||||
|
||||
|
||||
return when (status.visibility) {
|
||||
public -> status
|
||||
unlisted -> status
|
||||
|
|
Loading…
Reference in New Issue