Lines 17-27
document.addEventListener("DOMContentLoaded", function() {
Link Here
|
17 |
} |
17 |
} |
18 |
document.getElementById('barcode-container').innerHTML = svg |
18 |
document.getElementById('barcode-container').innerHTML = svg |
19 |
} catch (error) { |
19 |
} catch (error) { |
20 |
// Use regex to find error message |
|
|
21 |
const match = error.message.match(/: (.+)$/); |
22 |
const errorMessage = match ? match[1] : error.message; |
23 |
|
24 |
console.error(error); |
20 |
console.error(error); |
25 |
document.getElementById('barcode-container').innerHTML = "<p><strong>" + __("Error:") + " </strong>${errorMessage}</p>"; |
21 |
|
|
|
22 |
const p_node = document.createElement('p'); |
23 |
const strong_node = document.createElement('strong'); |
24 |
strong_node.textContent = __("Error: "); |
25 |
const span_node = document.createElement('span'); |
26 |
span_node.textContent = __("Unable to generate barcode"); |
27 |
span_node.setAttribute('id','barcode-gen-error'); |
28 |
p_node.appendChild(strong_node); |
29 |
p_node.appendChild(span_node); |
30 |
document.getElementById('barcode-container').replaceChildren(p_node); |
26 |
} |
31 |
} |
27 |
}); |
32 |
}); |
28 |
- |
|
|