From 8835aea1bc13f11fcb3d24771ee0620e8267ff7d Mon Sep 17 00:00:00 2001 From: Marta Carlos <101343976+OS-martacarlos@users.noreply.github.com> Date: Thu, 28 Mar 2024 09:45:12 +0000 Subject: [PATCH] feat: update error message (#37) https://outsystemsrd.atlassian.net/browse/RMET-3311 --- CHANGELOG.md | 4 ++++ hooks/android/androidCopyPreferences.js | 10 +++++----- hooks/ios/iOSCopyPreferences.js | 11 +++++------ 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 936e7fa..99ca724 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 The changes documented here do not include those from the original repository. +## [Unreleased] + +- Chore: Update cordova hooks with new OutSystems specific errors. (https://outsystemsrd.atlassian.net/browse/RMET-3311) + ## [Version 1.1.2] ### 21-12-2023 diff --git a/hooks/android/androidCopyPreferences.js b/hooks/android/androidCopyPreferences.js index 0fc2736..4da4f18 100644 --- a/hooks/android/androidCopyPreferences.js +++ b/hooks/android/androidCopyPreferences.js @@ -41,13 +41,13 @@ module.exports = function (context) { jsonParsed = JSON.parse(jsonConfigFile); } catch { - throw new Error("Missing configuration file or error trying to obtain the configuration."); + throw new Error("OUTSYSTEMS_PLUGIN_ERROR: Missing configuration file or error trying to obtain the configuration."); } - jsonParsed.app_configurations.forEach(function(configItem) { + jsonParsed.app_configurations.forEach((configItem) => { if (configItem.service_id == ServiceEnum.GooglePay) { hasGooglePay = true; - var error_list = []; + let error_list = []; if(configItem.merchant_name && configItem.merchant_name !== ""){ merchant_name = configItem.merchant_name; @@ -109,9 +109,9 @@ module.exports = function (context) { } if (error_list.length > 0) { - throw new Error("The following fields are either missing or empty in the configuration: " + error_list); + console.error("Missing fields: " + error_list); + throw new Error("OUTSYSTEMS_PLUGIN_ERROR: Payments configuration is missing some fields. Please check build logs to know more."); } - return; } }); diff --git a/hooks/ios/iOSCopyPreferences.js b/hooks/ios/iOSCopyPreferences.js index ad3dba5..83d00ec 100644 --- a/hooks/ios/iOSCopyPreferences.js +++ b/hooks/ios/iOSCopyPreferences.js @@ -40,12 +40,12 @@ module.exports = function (context) { let jsonConfigFile = fs.readFileSync(jsonConfig, 'utf8'); jsonParsed = JSON.parse(jsonConfigFile); } catch { - throw new Error("Missing configuration file or error trying to obtain the configuration."); + throw new Error("OUTSYSTEMS_PLUGIN_ERROR: Missing configuration file or error trying to obtain the configuration."); } - jsonParsed.app_configurations.forEach(function(configItem) { + jsonParsed.app_configurations.forEach((configItem) => { if (configItem.service_id == ServiceEnum.ApplePay) { - var error_list = []; + let error_list = []; if (configItem.merchant_id != null && configItem.merchant_id !== "") { merchant_id = configItem.merchant_id; @@ -102,10 +102,9 @@ module.exports = function (context) { } if (error_list.length > 0) { - throw new Error("Configuration is missing the following fields: " + error_list); + console.error("Missing fields: " + error_list); + throw new Error("OUTSYSTEMS_PLUGIN_ERROR: Payments configuration is missing some fields. Please check build logs to know more."); } - - return; } });