How to using and restricting it to trigger on one file? i.e ember.testing while doing onerror call?

I have implemented onerror call in my app.js file and inside it I am checking the ‘if’ condition for ‘ember.testing’ in route:

let onerror = function() { if (ember.testing) { throw error; }

but there is same condition i have in my component.js file. So, when error is triggered it call the component.js file , whereas i expected it should call my app.js file condition.

Please can anyone of you suggest the same?

Hi @sandeep49m could you go into a little more detail here? Maybe shared some code? It’s a little difficult to tell what you’re trying to do still.

try { if(x.trim() == “”) throw “empty”; if(isNaN(x)) throw “not a number”; x = Number(x); if(x < 5) throw “too low”; if(x > 10) throw “too high”; } catch(err) { throw new err; }

I expect the err will call onerror on route/app.js file

Ember.onerror = function (err) { pushError(err) }

But it is going to node_module/customPlugin.js Ember.onerror = function (err) { pushError(err) }

What i am expecting it should go to app.js file is not achievable. Please can you tell me how to restrict the node_module/customPlugin.js to trigger?