@reldens/server-utils 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/file-handler.js +4 -3
- package/package.json +1 -1
package/lib/file-handler.js
CHANGED
|
@@ -90,9 +90,7 @@ class FileHandler
|
|
|
90
90
|
let origin = Array.isArray(from) ? this.joinPaths(...from) : from;
|
|
91
91
|
let dest = Array.isArray(to) ? this.joinPaths(...to) : to;
|
|
92
92
|
if(!this.exists(origin)){
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
if(!this.exists(dest)){
|
|
93
|
+
this.error = {message: 'Failed to copy file, origin does not exists.', from, to, origin, dest};
|
|
96
94
|
return false;
|
|
97
95
|
}
|
|
98
96
|
try {
|
|
@@ -145,6 +143,7 @@ class FileHandler
|
|
|
145
143
|
fs.rmSync(crudTestPath);
|
|
146
144
|
return true;
|
|
147
145
|
} catch (error) {
|
|
146
|
+
this.error = {message: 'Failed to check permissions.', error, systemPath};
|
|
148
147
|
return false;
|
|
149
148
|
}
|
|
150
149
|
}
|
|
@@ -153,6 +152,7 @@ class FileHandler
|
|
|
153
152
|
{
|
|
154
153
|
let fileContents = this.fetchFileContents(filePath);
|
|
155
154
|
if(!fileContents){
|
|
155
|
+
this.error = {message: 'Failed to fetch file contents.', filePath};
|
|
156
156
|
return false;
|
|
157
157
|
}
|
|
158
158
|
let importedJson = JSON.parse(fileContents);
|
|
@@ -166,6 +166,7 @@ class FileHandler
|
|
|
166
166
|
fetchFileContents(filePath)
|
|
167
167
|
{
|
|
168
168
|
if(!this.isFile(filePath)){
|
|
169
|
+
this.error = {message: 'File check failed to fetch file contents.', filePath};
|
|
169
170
|
return false;
|
|
170
171
|
}
|
|
171
172
|
let fileContent = this.readFile(filePath);
|