Skip to content

Commit 7a001dd

Browse files
committed
rename a constant and log error
1 parent 071f6e7 commit 7a001dd

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

bin/helpers/capabilityHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ const validate = (bsConfig, args) => {
166166

167167
if (bsConfig.run_settings.userProvidedGeoLocation && !bsConfig.run_settings.geolocation.match(/^[A-Z]{2}$/g)) reject(Constants.validationMessages.INVALID_GEO_LOCATION);
168168

169-
if (bsConfig["connection_settings"]["local"] && bsConfig.run_settings.userProvidedGeoLocation) reject(Constants.validationMessages.INVALID_GEO_LOCATION_AND_LOCAL_MODE);
169+
if (bsConfig["connection_settings"]["local"] && bsConfig.run_settings.userProvidedGeoLocation) reject(Constants.validationMessages.NOT_ALLOWED_GEO_LOCATION_AND_LOCAL_MODE);
170170

171171
// validate if config file provided exists or not when cypress_config_file provided
172172
// validate the cypressProjectDir key otherwise.

bin/helpers/constants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ const validationMessages = {
9090
INVALID_GEO_LOCATION: "[BROWSERSTACK_INVALID_COUNTRY_CODE] The country code specified for 'browserstack.geoLocation' is invalid. For list of supported countries, refer to - https://www.browserstack.com/ip-geolocation",
9191
NOT_SUPPORTED_GEO_LOCATION: "The country code you have passed for IP Geolocation is currently not supported. Please refer the link https://www.browserstack.com/ip-geolocation for a list of supported countries.",
9292
NOT_AVAILABLE_GEO_LOCATION: "The country code you have passed for IP Geolocation is not available at the moment. Please try again in a few hours.",
93-
ACCESS_DENIED_GEO_LOCATION: "'geolocation' (IP Geolocation feature) capability is not supported in your account. It is only available under Enterprise plans, refer https://www.browserstack.com/ip-geolocation for more details."
93+
ACCESS_DENIED_GEO_LOCATION: "'geolocation' (IP Geolocation feature) capability is not supported in your account. It is only available under Enterprise plans, refer https://www.browserstack.com/ip-geolocation for more details.",
94+
NOT_ALLOWED_GEO_LOCATION_AND_LOCAL_MODE: "Cannot run IP Geolocation feature in conjunction with local mode."
9495
};
9596

9697
const cliMessages = {

bin/helpers/utils.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ exports.getErrorCodeFromMsg = (errMsg) => {
8888
case Constants.validationMessages.INVALID_GEO_LOCATION:
8989
errorCode = 'invalid_geo_location';
9090
break;
91+
case Constants.validationMessages.NOT_ALLOWED_GEO_LOCATION_AND_LOCAL_MODE:
92+
errorCode = 'not_allowed_geo_location_and_local_mode';
93+
break;
9194
}
9295
if (
9396
errMsg.includes("Please use --config-file <path to browserstack.json>.")

0 commit comments

Comments
 (0)