소스 검색

add errorhandling to deletePlugin function

NaokiHigashi28 1 년 전
부모
커밋
71bef31d72
1개의 변경된 파일9개의 추가작업 그리고 1개의 파일을 삭제
  1. 9 1
      apps/app/src/features/growi-plugin/server/services/growi-plugin/growi-plugin.ts

+ 9 - 1
apps/app/src/features/growi-plugin/server/services/growi-plugin/growi-plugin.ts

@@ -315,8 +315,16 @@ export class GrowiPluginService implements IGrowiPluginService {
       throw new Error('No plugin found for this ID.');
     }
 
+    let growiPluginsPath: fs.PathLike | undefined;
+    try {
+      growiPluginsPath = this.joinAndValidatePath(PLUGIN_STORING_PATH, growiPlugins.installedPath);
+    }
+    catch (err) {
+      logger.error(err);
+      throw new Error('Failed to constract plugin path');
+    }
+
     try {
-      const growiPluginsPath = path.join(PLUGIN_STORING_PATH, growiPlugins.installedPath);
       await deleteFolder(growiPluginsPath);
     }
     catch (err) {