Skip to content
Snippets Groups Projects
Commit 2fc23c32 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

FileBase.update() method throws more exceptions upon error

This will help to determine cause of any file update (e.g. rename)
failures, as reported by Nelgin.
parent 5f0fb1c7
No related branches found
No related tags found
No related merge requests found
Pipeline #6608 failed
...@@ -1047,6 +1047,8 @@ js_get_file_path(JSContext *cx, uintN argc, jsval *arglist) ...@@ -1047,6 +1047,8 @@ js_get_file_path(JSContext *cx, uintN argc, jsval *arglist)
JS_SET_RVAL(cx, arglist, STRING_TO_JSVAL(js_str)); JS_SET_RVAL(cx, arglist, STRING_TO_JSVAL(js_str));
smb_freefilemem(&file); smb_freefilemem(&file);
} }
else
JS_ReportError(cx, "%d loading file '%s'", p->smb_result, filename);
JS_RESUMEREQUEST(cx, rc); JS_RESUMEREQUEST(cx, rc);
free(filename); free(filename);
...@@ -1324,12 +1326,16 @@ js_update_file(JSContext *cx, uintN argc, jsval *arglist) ...@@ -1324,12 +1326,16 @@ js_update_file(JSContext *cx, uintN argc, jsval *arglist)
if(!readd_always && strcmp(extdesc ? extdesc : "", file.extdesc ? file.extdesc : "") == 0 if(!readd_always && strcmp(extdesc ? extdesc : "", file.extdesc ? file.extdesc : "") == 0
&& strcmp(auxdata ? auxdata : "", file.auxdata ? file.auxdata : "") == 0) && strcmp(auxdata ? auxdata : "", file.auxdata ? file.auxdata : "") == 0)
p->smb_result = smb_putfile(&p->smb, &file); p->smb_result = smb_putfile(&p->smb, &file);
if(p->smb_result != SMB_SUCCESS)
JS_ReportError(cx, "%d writing '%s'", p->smb_result, file.name);
else { else {
if((p->smb_result = smb_removefile(&p->smb, &file)) == SMB_SUCCESS) { if((p->smb_result = smb_removefile(&p->smb, &file)) == SMB_SUCCESS) {
if(readd_always) if(readd_always)
file.hdr.when_imported.time = 0; // we want the file to appear as "new" file.hdr.when_imported.time = 0; // we want the file to appear as "new"
p->smb_result = smb_addfile(&p->smb, &file, SMB_SELFPACK, extdesc, auxdata, newfname); p->smb_result = smb_addfile(&p->smb, &file, SMB_SELFPACK, extdesc, auxdata, newfname);
} }
else
JS_ReportError(cx, "%d removing '%s'", p->smb_result, file.name);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment