Scorpiion / vane

Server-side framework for Dart/Dartlang with a built-in middleware system.
BSD 3-Clause "New" or "Revised" License
59 stars 11 forks source link

Using mongodb with an invalid MONGODB_URI results in stack trace #5

Closed andreasolund closed 10 years ago

andreasolund commented 10 years ago

The issue occurs when an application tries to use the mongodb object on a server that has been started with an invalid MONGODB_URI environment variable. E.g starting a Vane server from the DartEditor on a local machine without MongoDB installed.

Stack trace:

2014-06-29 21:46:59.593 WARNING: The null object does not have a getter 'length'.

NoSuchMethodError: method not found: 'length'
Receiver: null
Arguments: []
2014-06-29 21:46:59.593 WARNING: 

2014-06-29 21:46:59.595 WARNING: #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#1      Uri.parse (dart:core/uri.dart:188)
#2      Db._parseUri (package:mongo_dart/src/database/db.dart:139:24)
#3      Db.open.<anonymous closure> (package:mongo_dart/src/database/db.dart:193:49)
#4      List.forEach (dart:core-patch/growable_array.dart:227)
#5      Db.open (package:mongo_dart/src/database/db.dart:192:21)
#6      _SessionManager.session (package:vane/src/session_manager.dart:55:30)
#7      Vane.mongodb (package:vane/src/vane.dart:507:37)
#8      getAll (file:///home/andreas/dart/vane001/bin/vane001.dart:372:5)
#9      Vane.call.<anonymous closure>.<anonymous closure> (package:vane/src/vane.dart:879:40)
#10     _rootRunUnary (dart:async/zone.dart:730)
#11     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#12     _CustomizedZone.runUnary (dart:async/zone.dart:667)
#13     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
#14     _Future._propagateToListeners (dart:async/future_impl.dart:571)
#15     _Future._completeWithValue (dart:async/future_impl.dart:331)
#16     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:393)
#17     _rootRun (dart:async/zone.dart:723)
#18     _ZoneDelegate.run (dart:async/zone.dart:453)
#19     _CustomizedZone.run (dart:async/zone.dart:663)
#20     _BaseZone.runGuarded (dart:async/zone.dart:574)
#21     _BaseZone.bindCallback.<anonymous closure> (dart:async/zone.dart:599)
#22     _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:23)
#23     _asyncRunCallback (dart:async/schedule_microtask.dart:32)
#24     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:128)

Maybe the database manager could check if MONGODB_URI is null on start and prevent applications from using the mongodb object?

Scorpiion commented 10 years ago

Now fixed and updated on pub, closing.