12

Angular.js does not provide human-readable error messages by default.

Is there anyway to change the default, cryptic Angular.js exception URL to a more readable error message? As it is, I have to copy the URL, remove the prefix, and paste in the browser to see what the problem is.

For example, transforming the following exception to a more useful error message:

Error: [ng:areq] http://errors.angularjs.org/1.3.0/ng/areq?p0=InterfaceController&p1=not%20a%20function%2C%20got%20undefined y/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular....

To something like:

"Missing required argument to InterfaceController"

I know I can provide my own exception handler:

.factory('$exceptionHandler', function () {
  return function errorCatcherHandler(exception, cause) {
    console.error(exception);
  };
});

Am I approaching this wrong?

2 Answers 2

17

The problem was that I was developing against the minified/compressed version (assuming it was like other JS libraries). The uncompressed version includes a readable error message.

https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js
https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.js
Sign up to request clarification or add additional context in comments.

1 Comment

saved me from hours!!
3

If you want to have readable error in your console, use non-minified version of angular libraries

--

To know what your current error is : copy those link and paste them in browser it will take you to the page where you can read more details about that particular error.

I pasted your error in browser url and i got

 Error: error:areq Bad Argument
 Argument 'InterfaceController' is not a function, got undefined 

1 Comment

Yes, that is what I said I was doing. I wanted to stop that though since it's a waste of time for most simple errors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.