Skip to content

Instantly share code, notes, and snippets.

@tarto-dev
Created October 21, 2019 12:42
Show Gist options
  • Save tarto-dev/767650fc69a7eb6924de951b84446bd3 to your computer and use it in GitHub Desktop.
Save tarto-dev/767650fc69a7eb6924de951b84446bd3 to your computer and use it in GitHub Desktop.
Perfect error handler :)
(function ($, Drupal) {
'use strict';
/**
* @type {Drupal~behavior#ben_stackOverLowl}
*/
Drupal.behaviors.ben_stackOverLowl = {
attach: function (context, settings) {
try {
// Ton code ici
} catch (e) {
window.location.href = "https://stackoverflow.com/search?q=[js]+[drupal]" + e.message;
}
}
};
}(jQuery, Drupal));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment