@@ -483,11 +483,11 @@ ipcMain.handle('plantuml:render-svg', async (_, diagram: string, format: 'svg' =
483483 return ;
484484 }
485485
486- const exitDetails = errorOutput . trim ( ) || `Renderer exited with code ${ code } .` ;
486+ const exitDetails = errorOutput . trim ( ) ;
487487 finalize ( {
488488 success : false ,
489- error : 'Local PlantUML renderer failed to produce output.' ,
490- details : exitDetails ,
489+ error : derivePlantumlFriendlyError ( exitDetails , code ?? undefined ) ,
490+ details : exitDetails || ( typeof code === 'number' ? `Renderer exited with code ${ code } .` : undefined ) ,
491491 } ) ;
492492 } ) ;
493493
@@ -514,6 +514,38 @@ let plantumlJarLookupPromise: Promise<string> | null = null;
514514
515515const PLANTUML_JAR_RELATIVE_PATH = path . join ( 'assets' , 'plantuml' , 'plantuml.jar' ) ;
516516
517+ function derivePlantumlFriendlyError ( details ?: string | null , exitCode ?: number ) : string {
518+ if ( details ) {
519+ const normalized = details . toLowerCase ( ) ;
520+
521+ if ( normalized . includes ( 'cannot run program' ) && normalized . includes ( '"dot"' ) ) {
522+ return 'Graphviz (the "dot" executable) is required for the local PlantUML renderer. Install Graphviz or add it to your PATH.' ;
523+ }
524+
525+ if ( normalized . includes ( 'graphviz' ) && normalized . includes ( 'not found' ) ) {
526+ return 'Graphviz binaries were not found. Install Graphviz to enable the local PlantUML renderer.' ;
527+ }
528+
529+ if ( normalized . includes ( 'unsupportedclassversionerror' ) ) {
530+ return 'The bundled PlantUML renderer requires a newer Java runtime. Update Java and try again.' ;
531+ }
532+
533+ if ( normalized . includes ( 'could not find or load main class' ) || normalized . includes ( 'classnotfoundexception' ) ) {
534+ return 'The PlantUML renderer could not start. Ensure assets/plantuml/plantuml.jar is present and accessible.' ;
535+ }
536+
537+ if ( normalized . includes ( 'permission denied' ) ) {
538+ return 'The PlantUML renderer could not be executed because of missing file permissions.' ;
539+ }
540+ }
541+
542+ if ( typeof exitCode === 'number' && exitCode !== 0 ) {
543+ return `Local PlantUML renderer exited with code ${ exitCode } .` ;
544+ }
545+
546+ return 'Local PlantUML renderer failed to produce output.' ;
547+ }
548+
517549async function resolvePlantUmlJar ( ) : Promise < string > {
518550 if ( cachedPlantumlJarPath ) {
519551 return cachedPlantumlJarPath ;
0 commit comments