Dartium gave me this error when I load my app (dart version, not compiled js) into browser:
Uncaught Error: Error evaluating expression 'model["mode"]': EvalException: Can't assign to null: model
I can see the error is caused by some code like this:
<polymer-element name="outer-element">
<!-- some codes here -->
<inner-element mode="model['mode']"></inner-element>
</polymer-element>
Where the model is a Map, model['mode'] is String, and the mode is declared via #published String mode on <inner-element>. Also, model is declared on <outer-element> via #published Map model so I can pass some map to <outer-element> in another custom element using <outer-element model="{{some map}}">.
This error doesn't make the app crash, actually, it has no effect as far as I can see, but it's really annoying to see it. (I have this error since the beginning of my development!)
I go through the data flow, but cannot find the problem.
Any idea would be appreciated. Thanks.
Version:
dart 1.4.2
polymer 0.10.1+1
polymer_expressions 0.10.0
dartium-win-full-stable-36647.0
If it helps, here is the stack trace:
Uncaught Error: Error evaluating expression 'model["mode"]': EvalException: Can't assign to null: model
Stack Trace:
#0 assign (package:polymer_expressions/eval.dart:137:18)
#1 _Binding.value= (package:polymer_expressions/polymer_expressions.dart:142:28)
#2 HtmlElement&Polymer.bindProperty (package:polymer/src/instance.dart:675:16)
#3 HtmlElement&Polymer.bind (package:polymer/src/instance.dart:447:34)
#4 _processBindings (package:template_binding/src/template_iterator.dart:186:38)
#5 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:71:19)
#6 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:60:26)
#7 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:60:26)
#8 TemplateBindExtension.createInstance (package:template_binding/src/template.dart:87:40)
#9 HtmlElement&Polymer.instanceTemplate (package:polymer/src/instance.dart:430:44)
#10 HtmlElement&Polymer.shadowFromTemplate (package:polymer/src/instance.dart:288:31)
#11 HtmlElement&Polymer.parseDeclaration (package:polymer/src/instance.dart:228:34)
#12 HtmlElement&Polymer.parseDeclarations (package:polymer/src/instance.dart:215:23)
#13 HtmlElement&Polymer.prepareElement (package:polymer/src/instance.dart:190:22)
#14 HtmlElement&Polymer.bind (package:polymer/src/instance.dart:437:42)
#15 _processBindings (package:template_binding/src/template_iterator.dart:186:38)
#16 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:71:19)
#17 TemplateBindExtension.createInstance (package:template_binding/src/template.dart:87:40)
#18 _TemplateIterator._handleSplices (package:template_binding/src/template_iterator.dart:449:53)
#19 _TemplateIterator._valueChanged (package:template_binding/src/template_iterator.dart:330:19)
#20 _TemplateIterator._updateIteratedValue (package:template_binding/src/template_iterator.dart:303:18)
#21 _TemplateIterator._updateDependencies (package:template_binding/src/template_iterator.dart:287:25)
#22 TemplateBindExtension._processBindingDirectives (package:template_binding/src/template.dart:50:34)
#23 _processBindings (package:template_binding/src/template_iterator.dart:197:51)
#24 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:71:19)
#25 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:60:26)
#26 _cloneAndBindInstance (package:template_binding/src/instance_binding_map.dart:60:26)
#27 TemplateBindExtension.createInstance (package:template_binding/src/template.dart:87:40)
#28 _TemplateIterator._handleSplices (package:template_binding/src/template_iterator.dart:449:53)
#29 _TemplateIterator._valueChanged (package:template_binding/src/template_iterator.dart:330:19)
#30 _updateIteratedValue (package:template_binding/src/template_iterator.dart:303:18)
#31 _check (package:polymer_expressions/polymer_expressions.dart:131:16)
#32 dirtyCheckZoneSpec.wrapUnaryCallback.<anonymous closure> (package:observe/src/dirty_check.dart:120:15)
#33 _rootRunUnary (dart:async/zone.dart:730)
#34 _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#35 _CustomizedZone.runUnary (dart:async/zone.dart:667)
#36 _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
#37 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:333)
#38 _DelayedData.perform (dart:async/stream_impl.dart:585)
#39 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:701)
#40 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:661)
#41 dirtyCheckZoneSpec.wrapCallback.<anonymous closure> (package:observe/src/dirty_check.dart:111:15)
#42 _rootRun (dart:async/zone.dart:719)
#43 _ZoneDelegate.run (dart:async/zone.dart:453)
#44 _CustomizedZone.run (dart:async/zone.dart:663)
#45 _BaseZone.runGuarded (dart:async/zone.dart:574)
#46 _BaseZone.bindCallback.<anonymous closure> (dart:async/zone.dart:599)
#47 dirtyCheckZoneSpec.wrapCallback.<anonymous closure> (package:observe/src/dirty_check.dart:111:15)
#48 _rootRun (dart:async/zone.dart:723)
#49 _ZoneDelegate.run (dart:async/zone.dart:453)
#50 _CustomizedZone.run (dart:async/zone.dart:663)
#51 _BaseZone.runGuarded (dart:async/zone.dart:574)
#52 _BaseZone.bindCallback.<anonymous closure> (dart:async/zone.dart:599)
#53 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:23)
#54 _asyncRunCallback (dart:async/schedule_microtask.dart:32)
#55 _handleMutation (file:///E:/b/build/slave/dartium-win-full-stable/build/src/dart/tools/dom/src/native_DOMImplementation.dart:588)
I suspect it has to do with:
Binding initialization when model is null
see also the comment here:
Polymer template repeat has weird side effect
The binding initialization can lead to situations where Polymer assigns to null or to non-assignable expressions. Previously they tried to suppress this errors but have seen situations where this is actually a bug and the developer should be notified about it, so they changed the behavior that errors are not suppressed but printed.
They try to figure out a way to improve this experience but seems not too easy.
This is just how I interpret some posts I read, I don't have any additional infos.
Related
My prestashop gives the following errors:
Fatal error: Uncaught Error: Call to a member function getProducts() on null in /var/www/html/minie.dk/public_html/modules/productsbundle/productsbundle.php:181 Stack trace: #0 /var/www/html/minie.dk/public_html/classes/Hook.php(591): ProductsBundle->hookActionCartSave(Array) #1 /var/www/html/minie.dk/public_html/classes/Hook.php(546): HookCore::coreCallHook(Object(ProductsBundle), 'hookactionCartS...', Array) #2 /var/www/html/minie.dk/public_html/classes/Cart.php(214): HookCore::exec('actionCartSave') #3 /var/www/html/minie.dk/public_html/classes/controller/FrontController.php(327): CartCore->update() #4 /var/www/html/minie.dk/public_html/classes/controller/Controller.php(170): FrontControllerCore->init() #5 /var/www/html/minie.dk/public_html/classes/Dispatcher.php(367): ControllerCore->run() #6 /var/www/html/minie.dk/public_html/index.php(28): DispatcherCore->dispatch() #7 {main} thrown in /var/www/html/minie.dk/public_html/modules/productsbundle/productsbundle.php on line 181
Can Anyone here see what the problem may be? And also, how to save it?
This problem is related to your 'productsbundle' module when a product is added to the customer's shopping cart.
I would suggest either to update this module to the latest version available or to disable it from your admin panel.
In the onBootstrap of my Application's Module.php I have registered a function onErrors on the EVENT_DISPATCH and EVENT_DISPATCH_ERROR events. In any of my models if I throw a custom error, Zend will catch it for me and in the onErrors function and I can handle the error (show an error page, return an error message as json, etc). This works fine except when an error is thrown in a function that's being used by Smarty. In that case I do still end up in the onErrors, but McvEvent->exception is NULL and I get this error:
Fatal error: Uncaught exception 'Application\Exception\InternalServerErrorException' in
/........../module/Smarty/src/Smarty/View/Renderer.php:90 Stack trace:
#0 /........../vendor/zendframework/zendframework/library/Zend/View/View.php(205):
Smarty\View\Renderer->render(Object(Zend\View\Model\ViewModel))
#1 /........../vendor/zendframework/zendframework/library/Zend/Mvc/View/Http/DefaultRenderingStrategy.php(102):
Zend\View\View->render(Object(Zend\View\Model\ViewModel))
#2 [internal function]:
Zend\Mvc\View\Http\DefaultRenderingStrategy->render(Object(Zend\Mvc\MvcEvent))
#3 /........../vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468):
call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#4 /........../vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207):
Zend\EventManager\EventManager->triggerListeners('render.error',
Object(Zend\Mvc\MvcEvent), Array)
#5 /.......... in
/........../module/Smarty/src/Smarty/View/Renderer.php on line 90
What's happening here? Why isn't Zend catching this error for me?
I'm working on school project, which requires to show some simple data from mysql database in browser. I've read, that SQLJocky doesn't work in browser so I decided to make it like server-client app and run db on server side (got inspiration here: https://dart-lang.github.io/server/codelab/). But it didn't work, failed in creating client api with message:
*in ShutdownIsolate: Unhandled exception:
IsolateSpawnException: Unable to spawn isolate: Unhandled exception:
Load Error for "package:sqljocky/sqljocky.dart": No mapping for 'sqljocky' package when resolving 'package:sqljocky/sqljocky.dart'.
#0 _asyncLoadErrorCallback (dart:_builtin:155)
#1 _asyncLoadError (dart:_builtin:566)
#2 _loadPackage (dart:_builtin:605)
#3 _loadData (dart:_builtin:637)
#4 _loadDataAsync (dart:_builtin:657)
#5 _loadScriptCallback (dart:_builtin:153)
#6 _handleLoaderReply (dart:_builtin:370)
#7 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)
'file:///home/alenka/dart-pokusy/server-side-app/one-hour-codelab/server/7-serve/lib/server/dbConnector.dart': error: line 1 pos 1: library handler failed
import 'package:sqljocky/sqljocky.dart';
^
#0 Isolate.spawnUri.<spawnUri_async_body> (dart:isolate-patch/isolate_patch.dart)
#1 _asyncErrorWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:34)
#2 _RootZone.runBinary (dart:async/zone.dart:1154)
#3 _Future._propagateToListeners.handleError (dart:async/future_impl.dart:579)
#4 _Future._propagateToListeners (dart:async/future_impl.dart:641)
#5 _Future._completeError (dart:async/future_impl.dart:432)
#6 _SyncCompleter._completeError (dart:async/future_impl.dart:56)
#7 _Completer.completeError (dart:async/future_impl.dart:27)
#8 Isolate._spawnCommon.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:439)
#9 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)*
Does anyone have idea how to solve this problem, or how to get data from db in browser differently?
Code added containing things from SQLJocky:
`import 'package:sqljocky/sqljocky.dart';
import 'dart:async';
...
#ApiMethod(path: 'connect')
Future<List<String>> dbConnect() async {
List<String> rows = [];
print('called dbConnect');
var pool = new ConnectionPool(
host: 'localhost',
port: 3306,
user: "root",
password: null,
db: 'project',
max: 5);
print('connection created');
var results = await pool.query('select * from User');
print('gonna write something from db');
results.forEach( (row){
print('Name: ${row[0]}, password: ${row[1]}');
rows.add('Name: ${row[0]}, password: ${row[1]}');
});
return rows;
}
`
Isolate your server side code and client side code into separates projects with their own pubspec.yaml.
I've found that sqljocky doesn't play nice with some of the client side libraries when both are in the pubspec.yaml.
Is there a simple example of custom component in MDL Dart http://www.material-design-lite.pub using a data table or a list linked to a model changing over time?
I have the exception
Exception: Uncaught Error: RangeError: Index out of range: index should be less than 6: 6
Stack Trace:
#0 HtmlCollection.[] (dart:html:17296)
#1 _ChildrenElementList.[] (dart:html:10623)
#2 MaterialRepeat.insert.<insert_async_body> (package:mdl/src/template/components/MaterialRepeat.dart:148:55)
#3 Future.Future.microtask.<anonymous closure> (dart:async/future.dart:144)
#4 _microtaskLoop (dart:async/schedule_microtask.dart:43)
#5 _microtaskLoopEntry (dart:async/schedule_microtask.dart:52)
#6 _ScheduleImmediateHelper._handleMutation (dart:html:42503)
Using the custom ToDo sample when updating the items list
Chapter_06 in AngularDart example
when I run it in Dartium, there are some error:
Observer reaction functions should not change model.
These watch changes were detected: ctrl.allRecipes: [Instance of 'Recipe', Instance of 'Recipe']
cmp.categories: [Appetizers, Salads, Soups, Main Dishes, Side Dishes, Desserts]
<= [Appetizers, Salads, Soups, Main Dishes, Side Dishes, Desserts]
These observe changes were detected:
STACKTRACE:
#0 RootScope.flush.<anonymous closure> (package:angular/core/scope.dart:554:11)
#1 RootScope.flush (package:angular/core/scope.dart:560:9)
#2 RootScope.flush (package:angular/core/scope.dart:561:7)
#3 RootScope.flush (package:angular/core/scope.dart:561:7)
#4 apply (package:angular/core/scope.dart:262:18)
#5 _rootRun (dart:async/zone.dart:710)
#6 _rootRun (dart:async/zone.dart:711)
#7 _rootRun (dart:async/zone.dart:711)
#8 _ZoneDelegate.run (dart:async/zone.dart:440)
#9 NgZone._finishTurn (package:angular/core/zone.dart:96:21)
How to fix it?