From a326a7364937ee2ca6d08cc172bd1f04191414d1 Mon Sep 17 00:00:00 2001 From: odoodo <61003874+odoodo@users.noreply.github.com> Date: Thu, 24 Oct 2024 14:58:46 +0200 Subject: [PATCH] make error messages more visible --- channel/MIRTH_MIGRATOR.xml | 74 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 3 deletions(-) diff --git a/channel/MIRTH_MIGRATOR.xml b/channel/MIRTH_MIGRATOR.xml index b38b442..a5c9798 100644 --- a/channel/MIRTH_MIGRATOR.xml +++ b/channel/MIRTH_MIGRATOR.xml @@ -7,9 +7,10 @@ Please check https://github.com/odoodo/Mirth-Migrator for further details. Version: +20241023: added installation validation at startup 20240822: added support for configuration frontend 20240521: initial version - 475 + 7 0 sourceConnector @@ -38,6 +39,10 @@ Version: a3a37aa1-ad7e-4825-a561-c2cec889e4c7 Mirth Migrator + + 265a8bca-979e-49c3-ba25-b217a6cfa9f2 + MirthMigrator + 1000 @@ -309,6 +314,10 @@ return true; a3a37aa1-ad7e-4825-a561-c2cec889e4c7 Mirth Migrator + + 265a8bca-979e-49c3-ba25-b217a6cfa9f2 + MirthMigrator + 1000 true @@ -415,6 +424,10 @@ IjogdHJ1ZQp9 a3a37aa1-ad7e-4825-a561-c2cec889e4c7 Mirth Migrator + + 265a8bca-979e-49c3-ba25-b217a6cfa9f2 + MirthMigrator + 1000 true @@ -513,6 +526,10 @@ Igp9 a3a37aa1-ad7e-4825-a561-c2cec889e4c7 Mirth Migrator + + 265a8bca-979e-49c3-ba25-b217a6cfa9f2 + MirthMigrator + 1000 true @@ -611,6 +628,10 @@ OWRhIiwKCQkiOGY3ODA3Y2UtM2NjZS00ZWZjLWE4ZjMtMzlhZWNmOTI1OWRiIgoJXQp9a3a37aa1-ad7e-4825-a561-c2cec889e4c7 Mirth Migrator + + 265a8bca-979e-49c3-ba25-b217a6cfa9f2 + MirthMigrator + 1000 true @@ -710,6 +731,10 @@ responseMap.put('response', JSON.stringify(conflictingComponents.paylo a3a37aa1-ad7e-4825-a561-c2cec889e4c7 Mirth Migrator + + 265a8bca-979e-49c3-ba25-b217a6cfa9f2 + MirthMigrator + 1000 true @@ -810,6 +835,10 @@ OC1iYTYyLTFhZTIzMTIzYjBiMyIsCgkJCSJ0eXBlIjogImNvZGVUZW1wbGF0ZSIKCQl9Cn0=a3a37aa1-ad7e-4825-a561-c2cec889e4c7 Mirth Migrator + + 265a8bca-979e-49c3-ba25-b217a6cfa9f2 + MirthMigrator + 1000 true @@ -915,6 +944,10 @@ OC1iYTYyLTFhZTIzMTIzYjBiMyIsCgkJCSJ0eXBlIjogImNvZGVUZW1wbGF0ZSIKCQl9Cn0=a3a37aa1-ad7e-4825-a561-c2cec889e4c7 Mirth Migrator + + 265a8bca-979e-49c3-ba25-b217a6cfa9f2 + MirthMigrator + 1000 true @@ -1019,6 +1052,10 @@ YjBlNi1lMjI2OTliZmEzYTMiLAoJCQkidHlwZSI6ICJjb2RlVGVtcGxhdGUiCgkJfQoJXQp9a3a37aa1-ad7e-4825-a561-c2cec889e4c7 Mirth Migrator + + 265a8bca-979e-49c3-ba25-b217a6cfa9f2 + MirthMigrator + 1000 true @@ -1114,6 +1151,10 @@ responseMap.put('response', JSON.stringify(environments.payload));a3a37aa1-ad7e-4825-a561-c2cec889e4c7 Mirth Migrator + + 265a8bca-979e-49c3-ba25-b217a6cfa9f2 + MirthMigrator + 1000 true @@ -1208,6 +1249,10 @@ responseMap.put('response', JSON.stringify(systems.payload)); a3a37aa1-ad7e-4825-a561-c2cec889e4c7 Mirth Migrator + + 265a8bca-979e-49c3-ba25-b217a6cfa9f2 + MirthMigrator + 1000 true @@ -1303,6 +1348,10 @@ responseMap.put('response', JSON.stringify(configuration.payload));a3a37aa1-ad7e-4825-a561-c2cec889e4c7 Mirth Migrator + + 265a8bca-979e-49c3-ba25-b217a6cfa9f2 + MirthMigrator + 1000 true @@ -1396,6 +1445,10 @@ responseMap.put('response', '{}'); a3a37aa1-ad7e-4825-a561-c2cec889e4c7 Mirth Migrator + + 265a8bca-979e-49c3-ba25-b217a6cfa9f2 + MirthMigrator + 1000 true @@ -1492,6 +1545,10 @@ responseMap.put('response', JSON.stringify(referencedCodeTemplate.payl a3a37aa1-ad7e-4825-a561-c2cec889e4c7 Mirth Migrator + + 265a8bca-979e-49c3-ba25-b217a6cfa9f2 + MirthMigrator + 1000 true @@ -1576,7 +1633,9 @@ try { var mirthMigratorFolder = new java.io.File('web'); if(!mirthMigratorFolder.exists() || !mirthMigratorFolder.isDirectory()){ + logger.error("#####################################################################################"); logger.error('\n\nThe Mirth Migrator folder was not found! \nPlease place the folder "web" at "' + rootPath + '".'); + logger.error("#####################################################################################"); ChannelUtil.undeployChannel(channelId); return; } @@ -1584,7 +1643,9 @@ try { // 2.) check if the Mirth Migrator library is at the right spot var jarFile = new java.io.File('web/MirthMigrator/jar/MirthMigrator.jar'); if(!jarFile.exists() || jarFile.isDirectory()){ + logger.error("#####################################################################################"); logger.error('\n\nThe Mirth Migrator library was not found! \nThe library must be located at "' + jarFile.getAbsolutePath() + '".'); + logger.error("#####################################################################################"); ChannelUtil.undeployChannel(channelId); return; } @@ -1600,11 +1661,15 @@ try { const mirthMigrator = dontDoThisAtHome.loadClass("lu.hrs.mirth.migration.MirthMigrator"); var mirthMigratorVersion= mirthMigrator.getMethod("getVersion").invoke(null); + logger.error("#####################################################################################"); logger.error('\n\nMirth Migrator v' + mirthMigratorVersion + ' was found at the right spot. \nHowever it seems like MirthMigrator.jar was not defined as a resource for channel ' + channelName + '. \n\nPlease define the library as a resource via Mirth Administrator: Settings/Resources \nand reference it in the channel (at Summary/Set Dependencies/Library Resources)!'); + logger.error("#####################################################################################"); ChannelUtil.undeployChannel(channelId); } catch (err) { // 4.) Not able to specify the error reason. Let's assume the file is corrupt. + logger.error("#####################################################################################"); logger.error('\n\nThe Mirth Migrator library "' + jarFile.getAbsolutePath() + '" seems to be corrupt. \nPlease redownload from https://github.com/odoodo/Mirth-Migrator/releases'); + logger.error("#####################################################################################"); ChannelUtil.undeployChannel(channelId); } @@ -1616,7 +1681,6 @@ var rhinoVersion = org.mozilla.javascript.Context.getCurrentContext().getImpleme // and indicate it in the logs logger.info('Mirth Migrator v' + mirthMigratorVersion + ' under JavaScript version: ' + rhinoVersion + ' started'); - return; return; @@ -1654,13 +1718,17 @@ return; a3a37aa1-ad7e-4825-a561-c2cec889e4c7 Mirth Migrator + + 265a8bca-979e-49c3-ba25-b217a6cfa9f2 + MirthMigrator + true - + Europe/Berlin