Browse Source

Handle errors when generating QR codes

main
Miraty 3 weeks ago
parent
commit
d0f211f61e
  1. 9
      index.php
  2. 2
      locales/en.php
  3. 2
      locales/fr.php
  4. 2
      locales/oc.php
  5. 2
      locales/template.php

9
index.php

@ -241,7 +241,14 @@ if ($validFormSubmitted) {
hexdec(substr($params['fgColor'],4,2))
));
$result = $qrCode->build();
try {
$result = $qrCode->build();
} catch (Exception $ex) {
http_response_code(500);
echo "<p><strong>" . $loc['error_generation'] . "</strong></p></body></html>";
error_log("LibreQR encountered an error while generating a QR code: " . $ex);
exit();
}
$dataUri = $result->getDataUri();

2
locales/en.php

@ -37,4 +37,6 @@ $loc = array(
<a href='https://en.wikipedia.org/wiki/QR_code' hreflang='en' rel='help external noreferrer'>QR code on Wikipedia</a>.
",
'metaText_legal' => "LibreQR " . LIBREQR_VERSION . " is a free software whose <a href='https://code.antopie.org/miraty/libreqr/' rel='external noreferrer'>source code</a> is available under the terms of the <abbr title='GNU Affero General Public License version 3 or any later version'><a href='LICENSE.html' hreflang='en' rel='license'>AGPLv3</a>+</abbr>.",
'error_generation' => "An error occurred while generating the QR code. Try with different parameters.",
);

2
locales/fr.php

@ -37,4 +37,6 @@ $loc = array(
<a href='https://fr.wikipedia.org/wiki/Code_QR' hreflang='fr' rel='help external noreferrer'>Code QR sur Wikipédia</a>.
",
'metaText_legal' => "LibreQR " . LIBREQR_VERSION . " est un logiciel libre dont le <a href='https://code.antopie.org/miraty/libreqr/' rel='external noreferrer'>code source</a> est disponible selon les termes de l'<abbr title='GNU Affero General Public License version 3 ou toute version ultérieure'><a href='LICENSE.html' hreflang='en' rel='license'>AGPLv3</a>+</abbr>.",
'error_generation' => "Une erreur a eu lieu lors de la génération du code QR. Essayez avec des paramètres différents.",
);

2
locales/oc.php

@ -37,4 +37,6 @@ $loc = array(
<a lang='ca' href='https://ca.wikipedia.org/wiki/Codi_QR' hreflang='ca' rel='help external noreferrer'>Còdi QR a la Wikipèdia</a>.
",
'metaText_legal' => "LibreQR " . LIBREQR_VERSION . " es un logicial liure que son <a href='https://code.antopie.org/miraty/libreqr/' rel='external noreferrer'>còdi font</a> es disponible jols tèrmes de la licéncia <abbr title='GNU Affero General Public License version 3 or any later version'><a href='LICENSE.html' hreflang='en' rel='license'>AGPLv3</a>+</abbr>.",
'error_generation' => "An error occurred while generating the QR code. Try with different parameters.",
);

2
locales/template.php

@ -29,4 +29,6 @@ $loc = array(
'metaText_qr' => "metaText_qr",
'metaText_legal' => "metaText_legal",
'error_generation' => "error_generation",
);

Loading…
Cancel
Save