@@ -123,22 +123,32 @@ export class FileShareAccessorHandle<Metadata> extends GenericFileAccessorHandle
123
123
if ( this . accessor . type !== Accessor . AccessType . FILE_SHARE ) {
124
124
return {
125
125
success : false ,
126
+ knownReason : false ,
126
127
reason : {
127
128
user : `There is an internal issue in Package Manager` ,
128
129
tech : `FileShare Accessor type is not FILE_SHARE ("${ this . accessor . type } ")!` ,
129
130
} ,
130
131
}
131
132
}
132
133
if ( ! this . originalFolderPath )
133
- return { success : false , reason : { user : `Folder path not set` , tech : `Folder path not set` } }
134
+ return {
135
+ success : false ,
136
+ knownReason : true ,
137
+ reason : { user : `Folder path not set` , tech : `Folder path not set` } ,
138
+ }
134
139
if ( ! this . content . onlyContainerAccess ) {
135
140
if ( ! this . filePath )
136
- return { success : false , reason : { user : `File path not set` , tech : `File path not set` } }
141
+ return {
142
+ success : false ,
143
+ knownReason : true ,
144
+ reason : { user : `File path not set` , tech : `File path not set` } ,
145
+ }
137
146
138
147
// Don't allow absolute file paths:
139
148
if ( betterPathIsAbsolute ( this . filePath ) )
140
149
return {
141
150
success : false ,
151
+ knownReason : true ,
142
152
reason : {
143
153
user : `File path is an absolute path` ,
144
154
tech : `File path "${ this . filePath } " is an absolute path` ,
@@ -151,6 +161,7 @@ export class FileShareAccessorHandle<Metadata> extends GenericFileAccessorHandle
151
161
if ( ! fullPath . startsWith ( folderPath ) )
152
162
return {
153
163
success : false ,
164
+ knownReason : true ,
154
165
reason : {
155
166
user : `File path is outside of folder path` ,
156
167
tech : `Full path "${ fullPath } " does not start with "${ folderPath } "` ,
@@ -198,18 +209,21 @@ export class FileShareAccessorHandle<Metadata> extends GenericFileAccessorHandle
198
209
if ( err && ( err as any ) . code === 'EBUSY' ) {
199
210
return {
200
211
success : false ,
212
+ knownReason : true ,
201
213
packageExists : true ,
202
214
reason : { user : `Not able to read file (file is busy)` , tech : `${ stringifyError ( err , true ) } ` } ,
203
215
}
204
216
} else if ( err && ( err as any ) . code === 'ENOENT' ) {
205
217
return {
206
218
success : false ,
219
+ knownReason : true ,
207
220
packageExists : false ,
208
221
reason : { user : `File does not exist` , tech : `${ stringifyError ( err , true ) } ` } ,
209
222
}
210
223
} else {
211
224
return {
212
225
success : false ,
226
+ knownReason : false ,
213
227
packageExists : false ,
214
228
reason : { user : `Not able to read file` , tech : `${ stringifyError ( err , true ) } ` } ,
215
229
}
@@ -227,6 +241,7 @@ export class FileShareAccessorHandle<Metadata> extends GenericFileAccessorHandle
227
241
// File is not readable
228
242
return {
229
243
success : false ,
244
+ knownReason : true ,
230
245
reason : {
231
246
user : `File doesn't exist` ,
232
247
tech : `Not able to read file: ${ stringifyError ( err , true ) } ` ,
@@ -244,6 +259,7 @@ export class FileShareAccessorHandle<Metadata> extends GenericFileAccessorHandle
244
259
// File is not writeable
245
260
return {
246
261
success : false ,
262
+ knownReason : true ,
247
263
reason : {
248
264
user : `Not able to write to container folder` ,
249
265
tech : `Not able to write to container folder: ${ stringifyError ( err , true ) } ` ,
@@ -384,7 +400,7 @@ export class FileShareAccessorHandle<Metadata> extends GenericFileAccessorHandle
384
400
}
385
401
386
402
if ( ! badReason ) return { success : true }
387
- else return { success : false , reason : badReason }
403
+ else return { success : false , knownReason : false , reason : badReason }
388
404
}
389
405
async setupPackageContainerMonitors (
390
406
packageContainerExp : PackageContainerExpectation
@@ -653,6 +669,7 @@ export class FileShareAccessorHandle<Metadata> extends GenericFileAccessorHandle
653
669
// File is not writeable
654
670
return {
655
671
success : false ,
672
+ knownReason : false ,
656
673
reason : {
657
674
user : `Not able to read from container folder` ,
658
675
tech : `Not able to read from container folder: ${ stringifyError ( err , true ) } ` ,
0 commit comments