From 7a22c9e3f0d94bb595b6f85cf67b02aa7e873941 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Fri, 23 Feb 2024 13:29:31 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Mastodon=20=E4=BA=92=E6=8F=9BAPI?= =?UTF-8?q?=E7=94=A8=E3=81=AE=E4=BE=8B=E5=A4=96=E3=82=92=E5=AE=9A=E7=BE=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/exception/ClientException.kt | 21 +++++++++++++++++++ .../domain/exception/MastodonApiException.kt | 21 +++++++++++++++++++ .../domain/exception/ServerException.kt | 21 +++++++++++++++++++ .../domain/model/MastodonApiErrorResponse.kt | 19 +++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/ClientException.kt create mode 100644 src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/MastodonApiException.kt create mode 100644 src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/ServerException.kt create mode 100644 src/main/kotlin/dev/usbharu/hideout/mastodon/domain/model/MastodonApiErrorResponse.kt diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/ClientException.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/ClientException.kt new file mode 100644 index 00000000..dcbab814 --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/ClientException.kt @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2024 usbharu + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dev.usbharu.hideout.mastodon.domain.exception + +import dev.usbharu.hideout.mastodon.domain.model.MastodonApiErrorResponse + +open class ClientException(response: MastodonApiErrorResponse<*>) : MastodonApiException(response) \ No newline at end of file diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/MastodonApiException.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/MastodonApiException.kt new file mode 100644 index 00000000..61447bf4 --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/MastodonApiException.kt @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2024 usbharu + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dev.usbharu.hideout.mastodon.domain.exception + +import dev.usbharu.hideout.mastodon.domain.model.MastodonApiErrorResponse + +abstract class MastodonApiException(val response: MastodonApiErrorResponse<*>) : RuntimeException() \ No newline at end of file diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/ServerException.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/ServerException.kt new file mode 100644 index 00000000..5498ab4d --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/ServerException.kt @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2024 usbharu + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dev.usbharu.hideout.mastodon.domain.exception + +import dev.usbharu.hideout.mastodon.domain.model.MastodonApiErrorResponse + +open class ServerException(response: MastodonApiErrorResponse<*>) : MastodonApiException(response) \ No newline at end of file diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/model/MastodonApiErrorResponse.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/model/MastodonApiErrorResponse.kt new file mode 100644 index 00000000..63935050 --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/model/MastodonApiErrorResponse.kt @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2024 usbharu + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dev.usbharu.hideout.mastodon.domain.model + +data class MastodonApiErrorResponse(val response: R, val statusCode: Int) \ No newline at end of file