mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 01:47:35 +00:00
feature(rest) patch -> tryCatch(patch)
This commit is contained in:
parent
09844d1a53
commit
22e825e068
1 changed files with 15 additions and 10 deletions
|
|
@ -92,11 +92,11 @@
|
|||
}
|
||||
|
||||
function onFS(pParams){
|
||||
var lWriteStream, lSize,
|
||||
var p, lWriteStream, lSize, lQuery,
|
||||
lRet = main.checkParams(pParams);
|
||||
if(lRet){
|
||||
var p = pParams,
|
||||
lQuery = main.getQuery(p.request);
|
||||
p = pParams,
|
||||
lQuery = main.getQuery(p.request);
|
||||
|
||||
p.name = Util.removeStrOneTime(p.name, CloudFunc.FS) || '/';
|
||||
switch(p.request.method){
|
||||
|
|
@ -148,14 +148,19 @@
|
|||
if (pError)
|
||||
main.sendError(pParams, pError);
|
||||
else {
|
||||
lDiff = diff.applyPatch(lStr, pPatch);
|
||||
|
||||
fs.writeFile(p.name, lDiff, function(){
|
||||
if (pError)
|
||||
main.sendError(pParams, pError);
|
||||
else
|
||||
main.sendResponse(pParams, 'writed: ' + p.name);
|
||||
var lRet = Util.tryCatchLog(function(){
|
||||
lDiff = diff.applyPatch(lStr, pPatch);
|
||||
});
|
||||
|
||||
if (lDiff && !lRet)
|
||||
fs.writeFile(p.name, lDiff, function(){
|
||||
if (pError)
|
||||
main.sendError(pParams, pError);
|
||||
else
|
||||
main.sendResponse(pParams, 'writed: ' + p.name);
|
||||
});
|
||||
else
|
||||
main.sendError(pParams, lRet || lDiff);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue