Skip to content

Commit

Permalink
Throw an error if Java Runtime not found while executing vdtool
Browse files Browse the repository at this point in the history
  • Loading branch information
subdan committed Oct 27, 2021
1 parent fe6dff8 commit 4143959
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/FigmaExport/Output/VectorDrawableConverter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ final class VectorDrawableConverter {
let outputString = String(decoding: outputData, as: UTF8.self)
// Only log last line out standard output
outputString.lastLine.flatMap { logger.info("\($0)") }


if error.contains("Unable to locate a Java Runtime") {
throw FigmaExportError.custom(errorString: error)
}

if error.contains(Self.notSupportedWarning) {
logger.warning("vd-tool reported unsupported xml tags. Executing vd-tool for each file...")
let enumerator = FileManager.default.enumerator(at: inputDirectoryUrl, includingPropertiesForKeys: nil)
Expand Down
3 changes: 3 additions & 0 deletions Sources/FigmaExport/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ enum FigmaExportError: LocalizedError {
case componentsNotFound
case accessTokenNotFound
case colorsAssetsFolderNotSpecified
case custom(errorString: String)

var errorDescription: String? {
switch self {
Expand All @@ -22,6 +23,8 @@ enum FigmaExportError: LocalizedError {
return "Environment varibale FIGMA_PERSONAL_TOKEN not specified."
case .colorsAssetsFolderNotSpecified:
return "Option ios.colors.assetsFolder not specified in configuration file."
case .custom(let errorString):
return errorString
}
}
}
Expand Down

0 comments on commit 4143959

Please sign in to comment.