[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't Suppress Errors When Creating Data Directory #1344

Merged
merged 3 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
log: errors when creating data dir
  • Loading branch information
4e6 committed Dec 10, 2020
commit f94415fcda7734e4a0c717e0966a660c7538ec14
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import org.slf4j.LoggerFactory

import scala.concurrent.Future
import scala.concurrent.duration._
import scala.util.control.NonFatal
import scala.util.{Failure, Success}

/** A main module containing all components of the server.
Expand All @@ -51,15 +52,23 @@ class MainModule(serverConfig: LanguageServerConfig, logLevel: LogLevel) {
val log = LoggerFactory.getLogger(this.getClass)
log.trace("Initializing...")

val directoriesConfig = DirectoriesConfig(serverConfig.contentRootPath)
val languageServerConfig = Config(
Map(serverConfig.contentRootUuid -> new File(serverConfig.contentRootPath)),
FileManagerConfig(timeout = 3.seconds),
PathWatcherConfig(),
ExecutionContextConfig(),
DirectoriesConfig(serverConfig.contentRootPath)
directoriesConfig
)
log.trace("Created Language Server config")

try {
directoriesConfig.createDirectories()
} catch {
case NonFatal(ex) =>
log.error("Error creating directories", ex)
}

val zioExec = ZioExec(zio.Runtime.default)
log.trace("Created ZioExec")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import org.enso.languageserver.filemanager.{
}

import scala.concurrent.duration._
import scala.util.Try

/** Configuration of the path watcher.
*
Expand Down Expand Up @@ -88,7 +87,9 @@ case class DirectoriesConfig(root: File) {
val suggestionsDatabaseFile: File =
new File(dataDirectory, DirectoriesConfig.SuggestionsDatabaseFile)

Try(Files.createDirectories(dataDirectory.toPath))
/** Create data directories if not exist. */
def createDirectories(): Unit =
Files.createDirectories(dataDirectory.toPath)
}

object DirectoriesConfig {
Expand Down