You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks, @danielmewes !
I think what we really care about is just the run result of the last finally (whether indexWait resolved or rejected). So I think the code should be something like:
...
r.table(dbConn.TABLE_NAME).indexWait(dbConn.INDEX_NAME).run(conn).then(function(){conn.close();successCallback();}).error(function(){console.log('Setting up database...');// The database/table/index was not available, create themr.dbCreate(dbConn.DATABASE_NAME).run(conn).finally(function(){returnr.tableCreate(dbConn.TABLE_NAME).run(conn);}).finally(function(){returnr.table(dbConn.TABLE_NAME).indexCreate(dbConn.INDEX_NAME).run(conn);}).catch(function(){})/*We swallow the results of the above promises*/.finally(function(){returnr.table(dbConn.TABLE_NAME).indexWait(dbConn.INDEX_NAME).run(conn);}).then(successCallback).error(function(err){console.log('Could not wait for the completion of indexing.')console.log(err.message);process.exit(1);}).finally(conn.close);});
...
This issue is about the demo of promise.
It seems that https://github.com/rethinkdb/rethinkdb-example-nodejs/blob/master/todo-angular-express-promise/app.js#L135 and https://github.com/rethinkdb/rethinkdb-example-nodejs/blob/master/todo-angular-express-promise/app.js#L137 can be rejected and since they are not handled by any
.error()
clause, it is likely to throw an error. I think the right way to do is:Or, are these codes written this way on specific purposes?
The text was updated successfully, but these errors were encountered: