Skip to content

Commit

Permalink
Started adding error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
morazow committed Aug 11, 2021
1 parent 406d464 commit e9b64a8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions error_code_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
error-tags:
CSE:
packages:
- com.exasol.cloudetl
1 change: 1 addition & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ object Dependencies {
"com.google.guava" % "guava" % "30.1.1-jre",
"com.exasol" %% "import-export-udf-common-scala" % ImportExportUDFVersion
exclude ("org.slf4j", "slf4j-simple"),
"com.exasol" % "error-reporting-java" % "0.4.0",
"org.apache.hadoop" % "hadoop-common" % HadoopVersion
exclude ("com.google.guava", "guava")
exclude ("org.apache.commons", "commons-text")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package com.exasol.cloudetl.filesystem
import java.io.FileNotFoundException
import java.nio.file.Path

import com.exasol.errorreporting.ExaError

import org.apache.hadoop.fs.{Path => HadoopPath}
import org.apache.hadoop.fs.FileStatus
import org.apache.hadoop.fs.FileSystem
Expand Down Expand Up @@ -33,11 +35,16 @@ final case class FileSystemManager(fileSystem: FileSystem) {
val statuses = fileSystem.globStatus(hadoopPath, HiddenFilesFilter)
if (statuses == null) {
throw new FileNotFoundException(
s"Provided file path '$path' does not exist. Please use valid path."
ExaError
.messageBuilder("F-CSE-1")
.message("Provided file path {{PATH}} does not exist.")
.parameter("PATH", path)
.mitigation("Please use valid file path.")
.toString()
)
} else {
if (isSingleDirectory(statuses)) {
// User path is a single directory without anyany glob, only then list the files.
// User path is a single directory without any glob, only then list the files.
listFiles(fileSystem.listStatus(statuses(0).getPath(), HiddenFilesFilter))
} else {
listFiles(statuses)
Expand Down

0 comments on commit e9b64a8

Please sign in to comment.