mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-02-20 05:41:32 +00:00
Merge pull request #1170 from hedgedoc/fix/fs_backend_logging
FilesystemBackend: Fix functionContext logging
This commit is contained in:
commit
d0aa73dfb3
1 changed files with 6 additions and 1 deletions
|
@ -58,19 +58,24 @@ export class FilesystemBackend implements MediaBackend {
|
|||
}
|
||||
|
||||
private async ensureDirectory(): Promise<void> {
|
||||
this.logger.debug(
|
||||
`Ensuring presence of directory at ${this.uploadDirectory}`,
|
||||
'ensureDirectory',
|
||||
);
|
||||
try {
|
||||
await fs.access(this.uploadDirectory);
|
||||
} catch (e) {
|
||||
try {
|
||||
this.logger.debug(
|
||||
`The directory '${this.uploadDirectory}' can't be accessed. Trying to create the directory`,
|
||||
'ensureDirectory',
|
||||
);
|
||||
await fs.mkdir(this.uploadDirectory);
|
||||
} catch (e) {
|
||||
this.logger.error(
|
||||
(e as Error).message,
|
||||
(e as Error).stack,
|
||||
'deleteFile',
|
||||
'ensureDirectory',
|
||||
);
|
||||
throw new MediaBackendError(
|
||||
`Could not create '${this.uploadDirectory}'`,
|
||||
|
|
Loading…
Reference in a new issue