Skip to content

Commit

Permalink
Remove logger.error as it throws errors
Browse files Browse the repository at this point in the history
Fixes #21
  • Loading branch information
WarningImHack3r committed Mar 17, 2024
1 parent 057bfd1 commit 9ef5e6f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

## [Unreleased]

### Fixed

- Fix error logging throwing crashes

## [0.7.3] - 2024-03-02

### Added
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pluginGroup = com.github.warningimhack3r.intellijshadcnplugin
pluginName = intellij-shadcn-plugin
pluginRepositoryUrl = https://github.com/WarningImHack3r/intellij-shadcn-plugin
# SemVer format -> https://semver.org
pluginVersion = 0.7.3
pluginVersion = 0.7.4

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 213
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ShellRunner(private val project: Project? = null) {

fun execute(command: Array<String>): String? {
val commandName = command.firstOrNull() ?: return null.also {
log.error("No command name provided")
log.warn("No command name provided")
}
if (isWindows() && failedCommands.contains(commandName)) {
command[0] = "$commandName.cmd"
Expand All @@ -38,7 +38,7 @@ class ShellRunner(private val project: Project? = null) {
failedCommands.add(commandName)
return execute(arrayOf("$commandName.cmd") + command.drop(1).toTypedArray())
}
log.error("Error while executing \"${command.joinToString(" ")}\"", e)
log.warn("Error while executing \"${command.joinToString(" ")}\"", e)
null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ abstract class Source<C : Config>(val project: Project, private val serializer:
log.debug("Parsed config: ${config.javaClass.name}")
}
} catch (e: Exception) {
log.error("Unable to parse $file", e)
throw UnparseableConfigException(project, "Unable to parse $file", e)
}
} ?: throw NoSuchFileException("$file not found")
Expand Down Expand Up @@ -85,7 +84,7 @@ abstract class Source<C : Config>(val project: Project, private val serializer:
}?.also {
log.info("Fetched ${it.size} remote components: ${it.joinToString(", ") { component -> component.name }}")
} ?: emptyList<Component>().also {
log.error("Unable to fetch remote components")
log.warn("Unable to fetch remote components")
}
}

Expand All @@ -97,7 +96,7 @@ abstract class Source<C : Config>(val project: Project, private val serializer:
}?.sorted()?.also {
log.info("Fetched ${it.size} installed components: ${it.joinToString(", ")}")
} ?: emptyList<String>().also {
log.error("Unable to fetch installed components")
log.warn("Unable to fetch installed components")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class SvelteSource(project: Project) : Source<SvelteConfig>(project, SvelteConfi
"Please run <code>npx svelte-kit sync</code> in your project directory to generate the file and try again.",
NotificationType.ERROR
)
log.error("Failed to generate $configFile, sent notification and throwing exception")
throw NoSuchFileException("Cannot get or generate $configFile")
}
Thread.sleep(250) // wait for the sync to create the files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,11 @@ class ISPWindowContents(private val project: Project) {
coroutineScope.launch {
source = runReadAction { SourceScanner.findShadcnImplementation(project) }
if (source == null) {
log.error("No shadcn/ui source found")
throw IllegalStateException("No shadcn/ui source found")
}
installedComponents = runReadAction { source!!.getInstalledComponents() }
}.invokeOnCompletion { throwable ->
if (throwable != null && throwable !is CancellationException) {
log.error("Failed to fetch source and installed components", throwable)
return@invokeOnCompletion
}
// Add a component panel
Expand Down

0 comments on commit 9ef5e6f

Please sign in to comment.