(text)
| 285 | const oldOnError = window.onerror |
| 286 | |
| 287 | const showError = function (text) { |
| 288 | if (currentErrors >= 3) { return } |
| 289 | if (app.isProduction() && !me.isAdmin()) { return } // Don't show noty error messages in production when not an admin |
| 290 | if (!me.isAdmin() && (document.location.href.search(/codecombat.com/) !== -1) && (document.location.href.search(/\/editor\//) === -1)) { return } |
| 291 | ++currentErrors |
| 292 | if (!(typeof webkit !== 'undefined' && webkit !== null ? webkit.messageHandlers : undefined)) { // Don't show these notys on iPad |
| 293 | return noty({ |
| 294 | text, |
| 295 | layout: 'topCenter', |
| 296 | type: 'error', |
| 297 | killer: false, |
| 298 | timeout: 5000, |
| 299 | dismissQueue: true, |
| 300 | maxVisible: 3, |
| 301 | callback: { onClose () { return --currentErrors } } |
| 302 | }) |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | window.onerror = function (msg, url, line, col, error) { |
| 307 | if (oldOnError) { oldOnError.apply(window, arguments) } |
no test coverage detected