Skip to content

Commit

Permalink
Export exceptions to JS (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenc-nanashi authored May 22, 2024
1 parent 00b60cd commit f1a5522
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package core.exception

@OptIn(ExperimentalJsExport::class)
@JsExport
class CannotReadFileException : Throwable()
2 changes: 2 additions & 0 deletions core/src/main/kotlin/core/exception/EmptyProjectException.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package core.exception

@OptIn(ExperimentalJsExport::class)
@JsExport
class EmptyProjectException : Throwable("This format could not take en empty project.")
2 changes: 2 additions & 0 deletions core/src/main/kotlin/core/exception/IllegalFileException.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package core.exception

@OptIn(ExperimentalJsExport::class)
@JsExport
sealed class IllegalFileException(message: String) : Throwable(message) {
class UnknownVsqVersion : IllegalFileException("Cannot identify the version of the loaded vsqx file.")
class XmlRootNotFound : IllegalFileException("The root element is not found in the xml file.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package core.exception

import core.model.Note

class IllegalNotePositionException(note: Note, trackIndex: Int) : Throwable(
@OptIn(ExperimentalJsExport::class)
@JsExport
class IllegalNotePositionException(@Suppress("NON_EXPORTABLE_TYPE") note: Note, trackIndex: Int) : Throwable(
"Failed to import because note with illegal position(${note.tickOn}) exists in Track No.${trackIndex + 1}",
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package core.exception

@OptIn(ExperimentalJsExport::class)
@JsExport
class NotesOverlappingException : Throwable(
"Failed to process because there are notes overlapping with each other.",
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package core.exception

@OptIn(ExperimentalJsExport::class)
@JsExport
open class UnsupportedFileFormatError : Exception()

@OptIn(ExperimentalJsExport::class)
@JsExport
class UnsupportedLegacyPpsfError : UnsupportedFileFormatError()
2 changes: 2 additions & 0 deletions core/src/main/kotlin/core/exception/ValueTooLargeException.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package core.exception

@OptIn(ExperimentalJsExport::class)
@JsExport
class ValueTooLargeException(value: String, maxValue: String) : Throwable(
"Given value $value is larger than the maximum: $maxValue.",
)

0 comments on commit f1a5522

Please sign in to comment.