Example #1
0
views.get = function getView( relPath ){
  var found;
  for( var i=0, pth; pth = this._views[i]; i++ ){
    var absPth = path.join( pth, relPath );
    if( fs.existsSync( absPth ) )
      return (found = absPth);
  }
  if( found ) return found;
  logger.throwError('could not find view', relPath, 'in none of the directories specified', this._views);
}
Example #2
0
 open: function openConnection( dbPathUri, callback ){
   if( this.connection )
     return;
   this.dbPathUri = dbPathUri;
   this.connection = new ConnectionHandler( dbPathUri );
   this.connection.adapter.logging( log._level );
   if( !this.connection.Schema )
     log.throwError('schema not implemented by chosen adapter! aborting');
   if( !this.connection.model )
     log.throwError('model not implemented by chosen adapter! aborting');
   this.Schema = this.connection.Schema;
   this.model = this.connection.model;
   this.ObjectId = this.connection.ObjectId;
   this.findAnyWithUser = this.connection.findAnyWithUser;
   this.findAnyByIdWithUser = this.connection.findAnyByIdWithUser;
   this.firstAnyWithUser = this.connection.firstAnyWithUser;
   if( typeof( callback ) === 'function' )
     callback();
 },
Example #3
0
views.add = function addView( pth ){
  if( !fs.existsSync( pth ) )
    logger.throwError('path', pth, 'does not exist');
  views._views.push( pth );
  logger.info( 'views path', pth, 'recognized');
}
Example #4
0
assert.throws(() => {
  test_error.throwError();
}, /^Error: error$/);