First of all, I'm not sure if this is an Angular problem or ES6 problem.
During some refactoring in our app, we extracted a method to a different file and by doing so we made the following mistake:
export const setDataTypeToColumn = (
row: any,
col: any
) => {
const updates = this.getChanges().updatedTables;
// Some code in here
}
this.getChanges()
is a method in the main file we used before the refactoring, but in this new file it does not exists, neither does in the arrow function as described.
However, when calling setDataTypeToColumn(x, y)
we don't get any console error. The application silently fails and what's worse, the follow-up code ends up not being executed.
It is only when I surround the call to setDataType with a try..catch where I get the exception error:
TypeError: _this.getChanges is not a function
at Object.push../src/app/components/model-structure/validators.ts.exports.setDataTypeToColumn (validators.ts:120)
at SetupComponent.push../src/app/components/model-structure/ .......
Is there any way to configure my environment (linter, compiler, angular itself) to catch these exceptions without having to spam my code with try/catch clauses all over the place?
Thanks for your answers and my apologies for the novice question