Enhance error message on unknown cartodb username

Closes #126
This commit is contained in:
Sandro Santilli 2013-12-18 12:02:51 +01:00
parent 87d35aa155
commit 80c30858bd
3 changed files with 4 additions and 2 deletions

View File

@ -2,6 +2,7 @@
------------------ ------------------
* Add 'user_from_host' directive to generalize username extraction (#124) * Add 'user_from_host' directive to generalize username extraction (#124)
* Enhance error message on unknown cartodb username (#126)
1.7.1 - 2013-12-02 1.7.1 - 2013-12-02
------------------ ------------------

View File

@ -197,7 +197,8 @@ function handleQuery(req, res) {
if (err) { if (err) {
// If the database could not be found, the user is non-existant // If the database could not be found, the user is non-existant
if ( err.message.match('missing') ) { if ( err.message.match('missing') ) {
err.message = "Sorry, we can't find this CartoDB. Please check that you have entered the correct domain."; err.message = "Sorry, we can't find CartoDB user '" + cdbuser
+ "'. Please check that you have entered the correct domain.";
err.http_status = 404; err.http_status = 404;
} }
throw err; throw err;

View File

@ -902,7 +902,7 @@ test('GET decent error if domain is incorrect', function(done){
assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8'); assert.deepEqual(res.headers['content-type'], 'application/json; charset=utf-8');
assert.deepEqual(res.headers['content-disposition'], 'inline'); assert.deepEqual(res.headers['content-disposition'], 'inline');
var result = JSON.parse(res.body); var result = JSON.parse(res.body);
assert.equal(result.error[0],"Sorry, we can't find this CartoDB. Please check that you have entered the correct domain."); assert.equal(result.error[0],"Sorry, we can't find CartoDB user 'vizzualinot'. Please check that you have entered the correct domain.");
done(); done();
}); });
}); });