Aurelia failed binding not throwing error? - javascript

I was wondering if aurelia should throw error on failed binding ? I use durandal a lot, and a useful feature was "binder.throwOnErrors = true;" If a binding failed it would throw an error in the console.
But in aurelia, say i got a "version" var in my VM. If i bind
${non-existing-var}
or even
${non-existing-object.non-existing-property}
it won't say anything.
So far aurelia is good, but sometimes it's a real pain to dig the template and to figure why the binding ain't working.
I've tried to dig in the aurelia-binding class, but could not find any clue.
Thank you :)
I also use the default configuration (i see [Debug] logs in the console)
aurelia.use
.standardConfiguration()
.developmentLogging();

Aurelia does not throw when an attempt is made to bind to an null/undefined property (or chain of properties). This is intentional- Aurelia supports binding to things that aren't yet defined but will become defined later.
Other developers have requested an option log these occurrences be added. This request is tracked here.

Related

How can I instantiate a new SystemError object in Node.js?

Looking at Node's documentation, SystemError extends the Error class. However, if you attempt to use SystemError directly, Node will throw a ReferenceError saying that SystemError is undefined.
Clearly, according to the docs, it is possible to encounter an instance of SystemError, but it seems impossible to recreate such an error in the usual way (e.g. throw new SystemError(args)).
I would like to test some code which is designed to interact with the specified SystemError API as detailed in the docs, but I have no idea how to recreate a SystemError. Is this even possible?
I think that node.js doesn't put SystemError available in order to avoid anyone (npm packages) to use it. So a SystemError is really a SystemError and not something else.
If you want to test it, generate the error : Try to read a file that doesn't exist for example.
An other soluce would be to recreate a lookalike error because you know every property of it. But it's a workaround actually.
https://nodejs.org/api/errors.html#errors_class_systemerror
In the Github https://github.com/DefinitelyTyped/DefinitelyTyped I couldn't find any interface declaration of SystemError.
Except custom implementations made by node-fetch, voximplant-websdk and alexa-sdk.
https://github.com/DefinitelyTyped/DefinitelyTyped/search?q=systemError&unscoped_q=systemError

Seeing `%s` instead of specific properties in react error messages in electron project?

All the React errors and warnings in my electron project look like this:
"Warning: Invalid event handler property `%s`. Did you mean `%s`?%s", source: webpack:///./node_modules/react-dom/cjs/react-dom.development.js? (506)
What would be causing this? Is something misconfigured? I'm not sure what to change. Tagged this four ways because I'm not sure where the issue lies.
Well, if you check the actual dev tools instead of the console, the issue isn't present there. Best I found.

GWT client - Uncaught TypeError: Cannot read property 'clear_31_g$' of undefined

I am new to GWT and trying to create a small application. I am currently assembling a small framework for the app, a generic layout handler, etc. This may not be the last problem I will bump into, but I just cannot find any solution to this on google.
So I have a class type, which return me Composites. Also, I have another one, which stores these kind of classes in Stack (I also tried Vector, I thought maybe GWT has issues with it). It didn't matter. If I call the .clear method on the Stack, I have the aforementioned error in the inspection menu of Chrome:
Uncaught TypeError: Cannot read property 'clear_31_g$' of undefined
Like if GWT does not know, how to convert this method to javascript or what? Do you know what is the problem here?
eclipse neon, Java 7 setting on Java SDK 1.8 (maybe this?), GWT 2.7.0 and App Engine 1.9.34
Thanks!
edit1: I also found the page, which contains the emulated JRE classes' list (http://www.gwtproject.org/doc/latest/RefJreEmulation.html) with all supported methods. Now I see, that clear is not on that list for Stack, but empty does and that gives me the same error. :-/
This error simply means that you try to call the clear() method on a null object (the object is undefined).
The error message itself is not as clear as it could be. First, it's not always about reading a property but also about calling a method. Second, remember that you run a compiled to javascript code and the property (or method) name may differ from the original one - it has something like _31_g$ added in the runtime.

CQ5 fails to load and execute ReauireJS module that runs on CQ6

I created a drag able component that what it does, is to require a certain module using RequireJS, and then executing this module. When I try to drag and use this component on CQ5, it fails to load, but on CQ6 it works fine!
edit1: CQ5 refers to localhost:4502/cf#/content/somePage.html url whereas CQ6 refers to
localhost:4502/editor.html/content/somePage.html
edit2: I tried to use more simpler component the depends on jQuery,
Backbone and underscore. It failed to execute because of binding
issue. I am trying to find now where CQ5 client code corrupting it.
Any help with that will be helpful!
One thing I saw, is that if I am adding the forceChannel query param, it loads the component, but fails to load the parsys fields. It also show the following error multiple time in the console:
Uncaught TypeError: Cannot read property 'edit' of undefined
It happens when it try to execute the following expression:
CQ.WCM.edit
Does anyone familiar with that issue? Or maybe show me where specifically might be the problem.
Thanks :)

Angular js - Strange behaviour when clearing cache

I am relatively new to Angular.js and am wondering about an error I get each time I clear my cache. Under normal circumstances my app runs without producing any console errors; however, if I clear my cache I always get the following error upon the first page refresh:
TypeError: object is not a function
at f (http://nakedisland.dev/lib/angular/angular-1.3.0-beta.7/angular.min.js:37:378)
at h.$eval (http://nakedisland.dev/lib/angular/angular-1.3.0-beta.7/angular.min.js:112:316)
at h.$digest (http://nakedisland.dev/lib/angular/angular-1.3.0-beta.7/angular.min.js:109:392)
at h.$delegate.__proto__.$digest (<anonymous>:844:31)
at h.$apply (http://nakedisland.dev/lib/angular/angular-1.3.0-beta.7/angular.min.js:113:100)
at h.$delegate.__proto__.$apply (<anonymous>:855:30)
at http://nakedisland.dev/lib/angular/angular-1.3.0-beta.7/angular.min.js:18:243
at Object.e [as invoke] (http://nakedisland.dev/lib/angular/angular-1.3.0-beta.7/angular.min.js:35:202)
at d (http://nakedisland.dev/lib/angular/angular-1.3.0-beta.7/angular.min.js:18:151)
at ic (http://nakedisland.dev/lib/angular/angular-1.3.0-beta.7/angular.min.js:18:360)
Since these are all internal errors with the angular.min.js file itself it's been difficult to trace anything back to my own code, and since I have several factory services which read from and write to localStorage it's necessary that I clear my cache regularly during the testing process.
What is the meaning of this error? It lists several lines which encounter the error but since the code is minified it's difficult to say which object is not a function.
Am I missing something? Or doing something incorrectly? (I know it might be hard to answer this without posting a large amount of code from my app, but the app code is very, very large.)
Since the error is produced only after cache clearing (i.e. not on initial loading from a new browser) should I even be worried about this error?
Thanks in advance!
I often get TypeErrors on page refreshes if my watches are not set up in a strict enough way. Your traceback looks similar to the ones I get.
Any $scope.$watch behavior will fire once on page load when the watch registers, unless you explicitly suppress that. The TypeError can happen when your watch tries to call a function, access an attribute, etc., that briefly does not yet exist (as the page as not fully loaded yet). The error then goes away as all of the objects/functions get defined and straighten themselves out.
If your watch depends on calling functions or accessing attributes that may not be defined yet, you may want to suppress the watch by simply returning if newVal and oldVal are equal, as they are when the watch registers:
$scope.$watch("yourVariable", function(newValue, oldValue) {
if(newValue === oldValue){
return;
}
alert("$watch triggered!");
});

Categories