The integration script reports most problems in the browser console instead of throwing. Where your code can react:
getInitialized() before opening, or await getInitializing()
(rejects on failure); see the Init Failure example.openDesigner() and open() return nothing (no promise; chaining
.then() throws a TypeError). Unknown codes, a missing print job and similar problems show the editor's
error dialog; closing it calls onClose('Error').setEditorButtons() / addEditorButton() throw synchronously.getPrintJob, getProofreading, clonePrintJob, ...) - the promise rejects.Close the editor's error dialog to see the onClose result in the log below.
Add data-td-log-level="debug" to the script tag for detailed console output while you develop.
onClose('Error').onClose('Error').onClose('Error').setEditorButtons() throws synchronously - caught with try/catch, the editor doesn't open.getPrintJob() with an unknown GUID - the promise rejects, caught with try/catch.try {
await window.tronDesigner.getInitializing(); // rejects when initialization failed
} catch (error) {
console.error('Designer not available:', error.cause ?? error.message);
}
// or, right before opening:
if (!window.tronDesigner?.getInitialized()) {
showError('The designer is not available right now.');
}
// openDesigner() returns nothing - don't chain .then() / .catch()
window.tronDesigner.openDesigner(editorArguments, {
mode: 'dialog',
onClose: (reason) => {
// 'Confirmed' | 'Cancelled' | 'Error'
if (reason === 'Error') showError('The designer could not be loaded. Please contact us.');
}
});
try {
window.tronDesigner
.setEditorButtons(buttonsFromConfig) // throws on invalid buttons - call it first
.setExactProduct('PFC', undefined, (b) => b.addVariant('10086021'))
.addExactPrinting('front', 'PAD03')
.open({ mode: 'dialog', onClose });
} catch (error) {
console.error('Could not open the designer', error);
}
try {
const printJob = await window.tronDesigner.getPrintJob(printJobGuid);
} catch (error) {
console.error('Print job could not be loaded', error.message, error.cause);
}