mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-18 09:04:44 -04:00
FilesystemBackend: Fix functionContext logging
This commit adds a few missing `functionContext` parameters in calls to `this.logger` and fixes a copy-paste error in `ensureDirectory` Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
d8cff8a9b1
commit
6aa85345d1
1 changed files with 6 additions and 1 deletions
|
@ -58,19 +58,24 @@ export class FilesystemBackend implements MediaBackend {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async ensureDirectory(): Promise<void> {
|
private async ensureDirectory(): Promise<void> {
|
||||||
|
this.logger.debug(
|
||||||
|
`Ensuring presence of directory at ${this.uploadDirectory}`,
|
||||||
|
'ensureDirectory',
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
await fs.access(this.uploadDirectory);
|
await fs.access(this.uploadDirectory);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
try {
|
try {
|
||||||
this.logger.debug(
|
this.logger.debug(
|
||||||
`The directory '${this.uploadDirectory}' can't be accessed. Trying to create the directory`,
|
`The directory '${this.uploadDirectory}' can't be accessed. Trying to create the directory`,
|
||||||
|
'ensureDirectory',
|
||||||
);
|
);
|
||||||
await fs.mkdir(this.uploadDirectory);
|
await fs.mkdir(this.uploadDirectory);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.error(
|
this.logger.error(
|
||||||
(e as Error).message,
|
(e as Error).message,
|
||||||
(e as Error).stack,
|
(e as Error).stack,
|
||||||
'deleteFile',
|
'ensureDirectory',
|
||||||
);
|
);
|
||||||
throw new MediaBackendError(
|
throw new MediaBackendError(
|
||||||
`Could not create '${this.uploadDirectory}'`,
|
`Could not create '${this.uploadDirectory}'`,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue