Skip to content

Commit

Permalink
fix: update to use resultasync
Browse files Browse the repository at this point in the history
  • Loading branch information
harishv7 committed Aug 15, 2023
1 parent 9211b39 commit a5d0cee
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/services/db/GitFileSystemService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,15 +481,10 @@ export default class GitFileSystemService {
.orElse((error) => {
if (error instanceof NotFoundError) {
// Create directory if it does not already exist
try {
fs.mkdirSync(pathToEfsDir)
return ok(true)
} catch (mkdirErr) {
logger.error(
`Error occurred while creating ${pathToEfsDir} directory: ${mkdirErr}`
)
return err(new GitFileSystemError("An unknown error occurred"))
}
return ResultAsync.fromPromise(
fs.promises.mkdir(pathToEfsDir),
(err) => new GitFileSystemError("An unknown error occurred")
).map((_) => true)
}
return err(error)
})
Expand Down

0 comments on commit a5d0cee

Please sign in to comment.