From 131f3df0642bd49ae53f61d107244eefb01a6f47 Mon Sep 17 00:00:00 2001
From: Copilot <198982749+Copilot@users.noreply.github.com>
Date: Fri, 9 Jan 2026 08:54:33 -0600
Subject: [PATCH 1/2] Fix error handling for non-Error objects in catch blocks
(#155)
* Initial plan
* Add getErrorMessage helper and update error handling in catch blocks
Co-authored-by: seanmcne <2292260+seanmcne@users.noreply.github.com>
* Fix getErrorMessage to properly handle null/undefined values
Co-authored-by: seanmcne <2292260+seanmcne@users.noreply.github.com>
* Add safety handling for JSON.stringify to prevent circular reference errors
Co-authored-by: seanmcne <2292260+seanmcne@users.noreply.github.com>
* Add e.name fallback for Error objects to provide more meaningful messages
Co-authored-by: seanmcne <2292260+seanmcne@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: seanmcne <2292260+seanmcne@users.noreply.github.com>
---
.../OrgDbOrgSettings/orgDBOrgSettings.html | 22 +++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/mspfedyn_/OrgDbOrgSettings/Solution/WebResources/mspfedyn_/OrgDbOrgSettings/orgDBOrgSettings.html b/mspfedyn_/OrgDbOrgSettings/Solution/WebResources/mspfedyn_/OrgDbOrgSettings/orgDBOrgSettings.html
index 8b0e462..4850614 100644
--- a/mspfedyn_/OrgDbOrgSettings/Solution/WebResources/mspfedyn_/OrgDbOrgSettings/orgDBOrgSettings.html
+++ b/mspfedyn_/OrgDbOrgSettings/Solution/WebResources/mspfedyn_/OrgDbOrgSettings/orgDBOrgSettings.html
@@ -726,6 +726,24 @@
}
return retval;
};
+ function getErrorMessage(e) {
+ ///Safely extracts an error message from any error type
+ ///Error object of any type
+ ///Error message string
+ if (e instanceof Error) return e.message || e.name || e.toString();
+ if (typeof e === 'string') return e;
+ if (e && typeof e === 'object') {
+ if (e.message) return e.message;
+ if (e.statusText) return e.statusText;
+ if (e.responseText) return e.responseText;
+ try {
+ return JSON.stringify(e);
+ } catch (jsonError) {
+ return Object.prototype.toString.call(e);
+ }
+ }
+ return e != null ? String(e) : 'Unknown error';
+ };
function resetYammerAttributes() {
try { //double confirmation for this setting, just in case.
var result = confirm("Proceed with removing your Yammer configuration from CRM? This should only be done when advised to do so or when required to fall back to using Activity Feeds.");
@@ -746,7 +764,7 @@
}
}
catch (e) {
- alert("Error editing setting in CRM - " + e.message);
+ alert("Error editing setting in CRM - " + getErrorMessage(e));
printSettingsToDiv();
enableProgressDiv(false);
}
@@ -814,7 +832,7 @@
}
}
catch (e) {
- alert("Error editing setting in CRM - " + e.message);
+ alert("Error editing setting in CRM - " + getErrorMessage(e));
printSettingsToDiv();
enableProgressDiv(false);
}
From d84a124c0bb97ee5e082be4b93c2b1ada0ccc016 Mon Sep 17 00:00:00 2001
From: Copilot <198982749+Copilot@users.noreply.github.com>
Date: Fri, 9 Jan 2026 13:22:18 -0600
Subject: [PATCH 2/2] Fix Number/Double validation for settings with empty max
values (#157)
* Initial plan
* Fix Number validation for settings with empty max values
* Add undefined check to maxNumber handling based on code review feedback
---
.../mspfedyn_/OrgDbOrgSettings/orgDBOrgSettings.html | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/mspfedyn_/OrgDbOrgSettings/Solution/WebResources/mspfedyn_/OrgDbOrgSettings/orgDBOrgSettings.html b/mspfedyn_/OrgDbOrgSettings/Solution/WebResources/mspfedyn_/OrgDbOrgSettings/orgDBOrgSettings.html
index 4850614..b598005 100644
--- a/mspfedyn_/OrgDbOrgSettings/Solution/WebResources/mspfedyn_/OrgDbOrgSettings/orgDBOrgSettings.html
+++ b/mspfedyn_/OrgDbOrgSettings/Solution/WebResources/mspfedyn_/OrgDbOrgSettings/orgDBOrgSettings.html
@@ -544,7 +544,16 @@
this.value = value
this.type = type;
this.minNumber = parseFloat(min).toString() === "NaN" ? null : parseFloat(min);
- this.maxNumber = parseFloat(max).toString() === "NaN" ? null : parseFloat(max);
+
+ // Handle empty or null max values for Number/Double types
+ var parsedMax = parseFloat(max);
+ if (isNaN(parsedMax) || max === "" || max === null || max === undefined) {
+ // For Number/Double types, use Int32.MaxValue as default max
+ this.maxNumber = (type && (type.toString().toLowerCase() === "number" || type.toString().toLowerCase() === "double")) ? 2147483647 : null;
+ } else {
+ this.maxNumber = parsedMax;
+ }
+
this.defaultValue = defaultValue;
this.supportUrl = supportUrl || "#";
this.description = description;