This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Unhelpful error message when passing wrong type to module.directive() #8127
Open
Description
When using a Javascript module system like Closure, it's possible to make a mistake like this:
goog.provide('foo.barDirective'); // sets foo.barDirective = {}
// typo, should be barDirective
foo.barDirectives = function() { return { link: function() {}};
app.directive('bar', foo.barDirective) // foo.barDirective is still {}
When an element using the directive is compiled, an error is raised with the message: Argument 'fn' is not a function, got Object
However, the information about what directive was being instantiated is lost, making it very difficult to trace the source of the error. Ideally, this information would be passed to the error handler.
Plunker: http://plnkr.co/edit/ly4g1yFFBpnSmShzNlcf?p=preview