Skip to content

Commit dc9fdc6

Browse files
feat: Add 'not permitted' type error code to createFileSystemError (#251)
1 parent ded2767 commit dc9fdc6

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/renderer/actions/local-sync/common-utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ export function isAccessError(error: any) {
201201
return error.code === "EACCES";
202202
}
203203

204+
export function isNotPermitted(error: any) {
205+
return error.code === "EPERM";
206+
}
207+
204208
export function isNotFoundError(error: any) {
205209
return error.code === "ENOENT";
206210
}
@@ -212,6 +216,8 @@ export function createFileSystemError(
212216
): FileSystemError {
213217
const errorCode = isAccessError(error)
214218
? ErrorCode.PermissionDenied
219+
: isNotPermitted(error)
220+
? ErrorCode.NotPermitted
215221
: isNotFoundError(error)
216222
? ErrorCode.NotFound
217223
: ErrorCode.UNKNOWN;

src/renderer/actions/local-sync/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export enum FileTypeEnum {
2222
export enum ErrorCode {
2323
WrongInput = "wrong_input",
2424
PermissionDenied = "permission_denied",
25+
NotPermitted = "not_permitted",
2526
MigrationFailed = "migration_failed",
2627
EntityAlreadyExists = "entity_already_exists",
2728
NotFound = "not_found",

0 commit comments

Comments
 (0)