From 944695d967c2f93e41e4bfd640238f3e9b1c9434 Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Wed, 12 Feb 2020 14:27:15 +0100 Subject: Changed Errors to IllegalStateExcpetions --- core/src/main/kotlin/parsers/MarkdownParser.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'core/src/main') diff --git a/core/src/main/kotlin/parsers/MarkdownParser.kt b/core/src/main/kotlin/parsers/MarkdownParser.kt index d70a2239..74569bd7 100644 --- a/core/src/main/kotlin/parsers/MarkdownParser.kt +++ b/core/src/main/kotlin/parsers/MarkdownParser.kt @@ -35,7 +35,7 @@ class MarkdownParser ( DocNodesFromIElementFactory.getInstance( node.type, visitNode(node.children.find { it.type == MarkdownTokenTypes.ATX_CONTENT } ?: - throw Error("Wrong AST Tree. ATX Header does not contain expected content")).children + throw IllegalStateException("Wrong AST Tree. ATX Header does not contain expected content")).children ) private fun horizontalRulesHandler(node: ASTNode): DocTag = @@ -100,13 +100,13 @@ class MarkdownParser ( declarationDescriptor, null, link.split('.') - ).also { if (it.size > 1) throw Error("Markdown link resolved more than one element: $it") }.firstOrNull()//.single() + ).also { if (it.size > 1) throw IllegalStateException("Markdown link resolved more than one element: $it") }.firstOrNull()//.single() ?.let { DRI.from(it) } } private fun referenceLinksHandler(node: ASTNode): DocTag { val linkLabel = node.children.find { it.type == MarkdownElementTypes.LINK_LABEL } ?: - throw Error("Wrong AST Tree. Reference link does not contain expected content") + throw IllegalStateException("Wrong AST Tree. Reference link does not contain expected content") val linkText = node.children.findLast { it.type == MarkdownElementTypes.LINK_TEXT } ?: linkLabel val linkKey = text.substring(linkLabel.startOffset, linkLabel.endOffset) @@ -118,9 +118,9 @@ class MarkdownParser ( private fun inlineLinksHandler(node: ASTNode): DocTag { val linkText = node.children.find { it.type == MarkdownElementTypes.LINK_TEXT } ?: - throw Error("Wrong AST Tree. Inline link does not contain expected content") + throw IllegalStateException("Wrong AST Tree. Inline link does not contain expected content") val linkDestination = node.children.find { it.type == MarkdownElementTypes.LINK_DESTINATION } ?: - throw Error("Wrong AST Tree. Inline link does not contain expected content") + throw IllegalStateException("Wrong AST Tree. Inline link does not contain expected content") val linkTitle = node.children.find { it.type == MarkdownElementTypes.LINK_TITLE } val link = text.substring(linkDestination.startOffset, linkDestination.endOffset) -- cgit