Skip to content

Commit

Permalink
Add exception handling in workspace template
Browse files Browse the repository at this point in the history
  • Loading branch information
serivesmejia committed Nov 8, 2024
1 parent 0c457fd commit 6c27838
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,21 @@

package com.github.serivesmejia.eocvsim.workspace.util

import com.github.serivesmejia.eocvsim.util.loggerForThis
import java.io.File

abstract class WorkspaceTemplate {

val logger by loggerForThis()

fun extractToIfEmpty(folder: File): Boolean {
if(folder.isDirectory && folder.listFiles()!!.isEmpty()) {
return extractTo(folder)
return try {
extractTo(folder)
} catch(e: Exception) {
logger.error("Error while extracting workspace template to $folder", e)
false
}
}

return false
Expand Down

0 comments on commit 6c27838

Please sign in to comment.