mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
replaced all stop callbacks with customError callbacks. Fixes #270
This commit is contained in:
parent
22fd5ae33d
commit
6684d6ed52
7 changed files with 59 additions and 38 deletions
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
var ERR = require("async-stacktrace");
|
||||
var customError = require("../utils/customError");
|
||||
require("../db/Pad");
|
||||
var db = require("./DB").db;
|
||||
|
||||
|
@ -47,7 +48,7 @@ exports.getPad = function(id, text, callback)
|
|||
//check if this is a valid padId
|
||||
if(!exports.isValidPadId(id))
|
||||
{
|
||||
callback({stop: id + " is not a valid padId"});
|
||||
callback(new customError(id + " is not a valid padId","apierror"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -64,14 +65,14 @@ exports.getPad = function(id, text, callback)
|
|||
//check if text is a string
|
||||
if(typeof text != "string")
|
||||
{
|
||||
callback({stop: "text is not a string"});
|
||||
callback(new customError("text is not a string","apierror"));
|
||||
return;
|
||||
}
|
||||
|
||||
//check if text is less than 100k chars
|
||||
if(text.length > 100000)
|
||||
{
|
||||
callback({stop: "text must be less than 100k chars"});
|
||||
callback(new customError("text must be less than 100k chars","apierror"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue