Skip to content

Commit d60ea1b

Browse files
committed
warn about not found printer strings
1 parent f9fc9b3 commit d60ea1b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/kotlin/de/gmuth/ipp/client/IppPrinter.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,11 +612,15 @@ class IppPrinter(
612612
.printerGroup.getValue("printer-strings-uri")
613613
}
614614

615-
fun savePrinterStrings(language: String = "en") =
615+
fun savePrinterStrings(language: String = "en") = try {
616616
getPrinterStringsUri(language).save(extension = "plist") // Apple property list
617+
} catch (fileNotFoundException: FileNotFoundException) {
618+
logger.warning { "Printer strings file not found: ${fileNotFoundException.message}" }
619+
null
620+
}
617621

618622
fun saveAllPrinterStrings(): Collection<File>? = attributes["printer-strings-languages-supported"]
619-
?.values?.map { savePrinterStrings(it as String) }
623+
?.values?.mapNotNull { savePrinterStrings(it as String) }
620624

621625
// --------------------------------------------------
622626
// Internal utilities implemented as Kotlin extension

0 commit comments

Comments
 (0)