mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-01 04:47:31 +09:00
Issue #1715 - Handle errors when initializing print settings from the printer
fails due to a bad printer name or O.S. error. Resolves #1715
This commit is contained in:
parent
de53821109
commit
82994ebc15
1 changed files with 12 additions and 2 deletions
|
|
@ -483,8 +483,18 @@ var Printing = {
|
||||||
printSettings.printerName = PSSVC.defaultPrinterName;
|
printSettings.printerName = PSSVC.defaultPrinterName;
|
||||||
}
|
}
|
||||||
// First get any defaults from the printer
|
// First get any defaults from the printer
|
||||||
PSSVC.initPrintSettingsFromPrinter(printSettings.printerName,
|
try {
|
||||||
printSettings);
|
PSSVC.initPrintSettingsFromPrinter(printSettings.printerName,
|
||||||
|
printSettings);
|
||||||
|
} catch(e) {
|
||||||
|
// The printer name specified was invalid or there was an O.S. error.
|
||||||
|
Components.utils.reportError("Invalid printer: " + printSettings.printerName);
|
||||||
|
Services.prefs.clearUserPref("print.print_printer");
|
||||||
|
// Try again with default
|
||||||
|
printSettings.printerName = PSSVC.defaultPrinterName;
|
||||||
|
PSSVC.initPrintSettingsFromPrinter(printSettings.printerName,
|
||||||
|
printSettings);
|
||||||
|
}
|
||||||
// now augment them with any values from last time
|
// now augment them with any values from last time
|
||||||
PSSVC.initPrintSettingsFromPrefs(printSettings, true,
|
PSSVC.initPrintSettingsFromPrefs(printSettings, true,
|
||||||
printSettings.kInitSaveAll);
|
printSettings.kInitSaveAll);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue