diff --git a/app/auth/oauth.js b/app/auth/oauth.js index 8f7959f7..298ef3c9 100644 --- a/app/auth/oauth.js +++ b/app/auth/oauth.js @@ -4,7 +4,6 @@ var _ = require('underscore'); var OAuthUtil = require('oauth-client'); var step = require('step'); -var assert = require('assert'); var CdbRequest = require('../models/cartodb_request'); var cdbReq = new CdbRequest(); @@ -90,7 +89,9 @@ var oAuth = (function(){ return oAuth.parseTokens(req); }, function getOAuthHash(err, _requestTokens) { - assert.ifError(err); + if (err) { + throw err; + } // this is oauth request only if oauth headers are present this.is_oauth_request = !_.isEmpty(_requestTokens); @@ -103,7 +104,9 @@ var oAuth = (function(){ } }, function regenerateSignature(err, oAuthHash){ - assert.ifError(err); + if (err) { + throw err; + } if (!this.is_oauth_request) { return null; } diff --git a/app/controllers/query_controller.js b/app/controllers/query_controller.js index 3c959264..f800a6e1 100644 --- a/app/controllers/query_controller.js +++ b/app/controllers/query_controller.js @@ -2,7 +2,6 @@ var _ = require('underscore'); var step = require('step'); -var assert = require('assert'); var PSQL = require('cartodb-psql'); var CachedQueryTables = require('../services/cached-query-tables'); const pgEntitiesAccessValidator = require('../services/pg-entities-access-validator'); @@ -158,7 +157,9 @@ QueryController.prototype.handleQuery = function (req, res, next) { }); }, function setHeaders(err, affectedTables) { - assert.ifError(err); + if (err) { + throw err; + } var mayWrite = queryMayWrite(sql); if ( req.profiler ) { @@ -206,7 +207,9 @@ QueryController.prototype.handleQuery = function (req, res, next) { return null; }, function generateFormat(err){ - assert.ifError(err); + if (err) { + throw err; + } checkAborted('generateFormat'); // TODO: drop this, fix UI! diff --git a/app/models/formats/ogr.js b/app/models/formats/ogr.js index f13b31d4..c2c44992 100644 --- a/app/models/formats/ogr.js +++ b/app/models/formats/ogr.js @@ -6,7 +6,6 @@ var fs = require('fs'); var _ = require('underscore'); var PSQL = require('cartodb-psql'); var spawn = require('child_process').spawn; -var assert = require('assert'); // Keeps track of what's waiting baking for export var bakingExports = {}; @@ -95,7 +94,9 @@ OgrFormat.prototype.toOGR = function(options, out_format, out_filename, callback pg.query(colsql, this); }, function findSRS(err, result) { - assert.ifError(err); + if (err) { + throw err; + } var needSRS = that._needSRS; @@ -139,7 +140,9 @@ OgrFormat.prototype.toOGR = function(options, out_format, out_filename, callback }); }, function spawnDumper(err, srid, type) { - assert.ifError(err); + if (err) { + throw err; + } var next = this; diff --git a/app/models/formats/ogr/shp.js b/app/models/formats/ogr/shp.js index e16c3931..64e5b622 100644 --- a/app/models/formats/ogr/shp.js +++ b/app/models/formats/ogr/shp.js @@ -3,7 +3,6 @@ var step = require('step'); var fs = require('fs'); var spawn = require('child_process').spawn; -var assert = require('assert'); var ogr = require('./../ogr'); @@ -51,12 +50,16 @@ ShpFormat.prototype.toSHP = function (options, callback) { fs.mkdir(outdirpath, 0o777, this); }, function spawnDumper(err) { - assert.ifError(err); + if (err) { + throw err; + } fmtObj.toOGR(options, 'ESRI Shapefile', shapefile, this); }, function doZip(err) { - assert.ifError(err); + if (err) { + throw err; + } var next = this; diff --git a/app/models/formats/pg.js b/app/models/formats/pg.js index 3a98bd59..22198e84 100644 --- a/app/models/formats/pg.js +++ b/app/models/formats/pg.js @@ -2,7 +2,6 @@ var step = require('step'); var PSQL = require('cartodb-psql'); -var assert = require('assert'); function PostgresFormat(id) { this.id = id; @@ -82,8 +81,9 @@ PostgresFormat.prototype.handleQueryEnd = function(result) { that.transform(result, that.opts, this); }, function sendResults(err, out){ - - assert.ifError(err); + if (err) { + throw err; + } // return to browser if ( out ) {