Refactor duplicate error handling into fetchErrorMessage helper#7644
Merged
Refactor duplicate error handling into fetchErrorMessage helper#7644
Conversation
16 tasks
Co-authored-by: DawoudIO <554959+DawoudIO@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update financial report UX based on review feedback
Refactor duplicate error handling into fetchErrorMessage helper
Nov 26, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors duplicate error handling logic in VerifyThenLoadAPIContent by extracting repeated AJAX error message fetching code into a reusable fetchErrorMessage helper function. The refactoring addresses code review feedback from PR #7642 and improves code maintainability without introducing any functional changes.
Key Changes:
- Extracted duplicate error handling logic from 404 and 500 status code handlers into a single
fetchErrorMessagehelper function - Reduced code duplication by ~40 lines while maintaining identical behavior
Comments suppressed due to low confidence (5)
src/skin/js/CRMJSOM.js:248
- Variable selection is used like a local variable, but is missing a declaration.
selection = {
src/skin/js/CRMJSOM.js:259
- Variable groupsList is used like a local variable, but is missing a declaration.
groupsList = rdata.map(function (item) {
src/skin/js/CRMJSOM.js:268
- Variable $groupSelect2 is used like a local variable, but is missing a declaration.
$groupSelect2 = $("#targetGroupSelection").select2({
src/skin/js/CRMJSOM.js:282
- Variable rolesList is used like a local variable, but is missing a declaration.
rolesList = rdata.map(function (item) {
src/skin/js/CRMJSOM.js:297
- Variable params is used like a local variable, but is missing a declaration.
params = {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
Extracts duplicate error handling logic for 404/500 status codes in
VerifyThenLoadAPIContentinto a reusablefetchErrorMessagehelper function.Addresses review feedback from #7642.
Type
Testing
No functional change. The helper function encapsulates the same AJAX call pattern previously duplicated in both 404 and 500 handlers.
Before (repeated in both handlers):
After:
Screenshots
N/A - No UI changes
Security Check
Code Quality
Pre-Merge
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.