From f1ba00b8dbadef0bb0b896863d99b6d09f6e564b Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sun, 22 Dec 2024 13:10:00 +0100 Subject: [PATCH] Move IO exceptions to exceptions.io package --- .../FileOrDirectoryNotFoundException.kt | 4 +-- .../{ => io}/FileTooLargeException.kt | 8 +++--- .../exception/{ => io}/IOAccessException.kt | 5 ++-- .../engine/base/exception/io/package-info.kt | 26 +++++++++++++++++++ .../engine/base/exception/package-info.kt | 2 +- 5 files changed, 36 insertions(+), 9 deletions(-) rename base/src/main/kotlin/de/staropensource/engine/base/exception/{ => io}/FileOrDirectoryNotFoundException.kt (85%) rename base/src/main/kotlin/de/staropensource/engine/base/exception/{ => io}/FileTooLargeException.kt (87%) rename base/src/main/kotlin/de/staropensource/engine/base/exception/{ => io}/IOAccessException.kt (91%) create mode 100644 base/src/main/kotlin/de/staropensource/engine/base/exception/io/package-info.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/exception/FileOrDirectoryNotFoundException.kt b/base/src/main/kotlin/de/staropensource/engine/base/exception/io/FileOrDirectoryNotFoundException.kt similarity index 85% rename from base/src/main/kotlin/de/staropensource/engine/base/exception/FileOrDirectoryNotFoundException.kt rename to base/src/main/kotlin/de/staropensource/engine/base/exception/io/FileOrDirectoryNotFoundException.kt index 7de1cab..0ddee8b 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/exception/FileOrDirectoryNotFoundException.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/exception/io/FileOrDirectoryNotFoundException.kt @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.staropensource.engine.base.exception +package de.staropensource.engine.base.exception.io /** * Thrown when being unable to @@ -25,4 +25,4 @@ package de.staropensource.engine.base.exception * * @since v1-alpha10 */ -class FileOrDirectoryNotFoundException(val path: String, val throwable: Throwable? = null) : RuntimeException("The file or directory '${path}' could not be found", throwable) +class FileOrDirectoryNotFoundException(val path: String, val throwable: Throwable? = null) : Exception("The file or directory '${path}' could not be found", throwable) diff --git a/base/src/main/kotlin/de/staropensource/engine/base/exception/FileTooLargeException.kt b/base/src/main/kotlin/de/staropensource/engine/base/exception/io/FileTooLargeException.kt similarity index 87% rename from base/src/main/kotlin/de/staropensource/engine/base/exception/FileTooLargeException.kt rename to base/src/main/kotlin/de/staropensource/engine/base/exception/io/FileTooLargeException.kt index 7d55339..d1f44ce 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/exception/FileTooLargeException.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/exception/io/FileTooLargeException.kt @@ -17,12 +17,12 @@ * along with this program. If not, see . */ -package de.staropensource.engine.base.exception +package de.staropensource.engine.base.exception.io /** - * Thrown when reading a file fails - * due to it being larger than the - * configured max heap size. + * Thrown when reading a file + * fails due to it being larger + * than the heap. * * @since v1-alpha10 */ diff --git a/base/src/main/kotlin/de/staropensource/engine/base/exception/IOAccessException.kt b/base/src/main/kotlin/de/staropensource/engine/base/exception/io/IOAccessException.kt similarity index 91% rename from base/src/main/kotlin/de/staropensource/engine/base/exception/IOAccessException.kt rename to base/src/main/kotlin/de/staropensource/engine/base/exception/io/IOAccessException.kt index 8824c24..9b32763 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/exception/IOAccessException.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/exception/io/IOAccessException.kt @@ -17,10 +17,11 @@ * along with this program. If not, see . */ -package de.staropensource.engine.base.exception +package de.staropensource.engine.base.exception.io /** - * Thrown when an IO error occurs. + * Thrown when a general + * IO error occurs. * * @since v1-alpha10 */ diff --git a/base/src/main/kotlin/de/staropensource/engine/base/exception/io/package-info.kt b/base/src/main/kotlin/de/staropensource/engine/base/exception/io/package-info.kt new file mode 100644 index 0000000..e8dacf8 --- /dev/null +++ b/base/src/main/kotlin/de/staropensource/engine/base/exception/io/package-info.kt @@ -0,0 +1,26 @@ +/* + * STAROPENSOURCE ENGINE SOURCE FILE + * Copyright (c) 2024 The StarOpenSource Engine Authors + * Licensed under the GNU General Public License v3. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +/** + * Exceptions thrown when + * interacting with IO. + * + * @since v1-alpha10 + */ +package de.staropensource.engine.base.exception.io diff --git a/base/src/main/kotlin/de/staropensource/engine/base/exception/package-info.kt b/base/src/main/kotlin/de/staropensource/engine/base/exception/package-info.kt index 55fd5ef..5da7a0c 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/exception/package-info.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/exception/package-info.kt @@ -18,7 +18,7 @@ */ /** - * Exceptions thrown by the engine. + * Miscellaneous exceptions. * * @since v1-alpha10 */