Error messages in the UI
This commit is contained in:
parent
87c935ac47
commit
6145a938e3
5 changed files with 51 additions and 11 deletions
|
@ -24,7 +24,7 @@ DocumentHandler.prototype.handleGet = function(key, response, skipExpire) {
|
|||
else {
|
||||
winston.warn('document not found', { key: key });
|
||||
response.writeHead(404, { 'content-type': 'application/json' });
|
||||
response.end(JSON.stringify({ message: 'document not found' }));
|
||||
response.end(JSON.stringify({ message: 'Document not found.' }));
|
||||
}
|
||||
}, skipExpire);
|
||||
};
|
||||
|
@ -40,7 +40,7 @@ DocumentHandler.prototype.handleRawGet = function(key, response, skipExpire) {
|
|||
else {
|
||||
winston.warn('raw document not found', { key: key });
|
||||
response.writeHead(404, { 'content-type': 'application/json' });
|
||||
response.end(JSON.stringify({ message: 'document not found' }));
|
||||
response.end(JSON.stringify({ message: 'Document not found.' }));
|
||||
}
|
||||
}, skipExpire);
|
||||
};
|
||||
|
@ -58,7 +58,7 @@ DocumentHandler.prototype.handlePost = function(request, response) {
|
|||
_this.cancelled = true;
|
||||
winston.warn('document >maxLength', { maxLength: _this.maxLength });
|
||||
response.writeHead(400, { 'content-type': 'application/json' });
|
||||
response.end(JSON.stringify({ message: 'document exceeds maximum length' }));
|
||||
response.end(JSON.stringify({ message: 'Document exceeds maximum length.' }));
|
||||
}
|
||||
});
|
||||
request.on('end', function(end) {
|
||||
|
@ -72,7 +72,7 @@ DocumentHandler.prototype.handlePost = function(request, response) {
|
|||
else {
|
||||
winston.verbose('error adding document');
|
||||
response.writeHead(500, { 'content-type': 'application/json' });
|
||||
response.end(JSON.stringify({ message: 'error adding document' }));
|
||||
response.end(JSON.stringify({ message: 'Error adding document.' }));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -80,7 +80,7 @@ DocumentHandler.prototype.handlePost = function(request, response) {
|
|||
request.on('error', function(error) {
|
||||
winston.error('connection error: ' + error.message);
|
||||
response.writeHead(500, { 'content-type': 'application/json' });
|
||||
response.end(JSON.stringify({ message: 'connection error' }));
|
||||
response.end(JSON.stringify({ message: 'Connection error.' }));
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue