Skip to content

Commit

Permalink
chore: Replace occurrences of the deprecated errorAndThrow API
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach committed Dec 12, 2024
1 parent 4444172 commit b01f113
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/extensions/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ async function setAccess (bundleId, permissionsMapping) {
resetPermissions.push(serviceName);
break;
default:
this.log.errorAndThrow(
throw this.log.errorWithException(
`${serviceName} does not support ${permissionsMapping[serviceName]}. Please specify 'yes', 'no' or 'unset'.`
);
}
Expand Down
8 changes: 4 additions & 4 deletions lib/extensions/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ export function verifyDevicePreferences (prefs = {}) {

if (!_.isUndefined(prefs.SimulatorWindowLastScale)) {
if (!_.isNumber(prefs.SimulatorWindowLastScale) || prefs.SimulatorWindowLastScale <= 0) {
this.log.errorAndThrow(`SimulatorWindowLastScale is expected to be a positive float value. ` +
throw this.log.errorWithException(`SimulatorWindowLastScale is expected to be a positive float value. ` +
`'${prefs.SimulatorWindowLastScale}' is assigned instead.`);
}
}
Expand All @@ -366,22 +366,22 @@ export function verifyDevicePreferences (prefs = {}) {
// https://regex101.com/r/2ZXOij/2
const verificationPattern = /{-?\d+(\.\d+)?,-?\d+(\.\d+)?}/;
if (!_.isString(prefs.SimulatorWindowCenter) || !verificationPattern.test(prefs.SimulatorWindowCenter)) {
this.log.errorAndThrow(`SimulatorWindowCenter is expected to match "{floatXPosition,floatYPosition}" format (without spaces). ` +
throw this.log.errorWithException(`SimulatorWindowCenter is expected to match "{floatXPosition,floatYPosition}" format (without spaces). ` +
`'${prefs.SimulatorWindowCenter}' is assigned instead.`);
}
}

if (!_.isUndefined(prefs.SimulatorWindowOrientation)) {
const acceptableValues = ['Portrait', 'LandscapeLeft', 'PortraitUpsideDown', 'LandscapeRight'];
if (!prefs.SimulatorWindowOrientation || !acceptableValues.includes(prefs.SimulatorWindowOrientation)) {
this.log.errorAndThrow(`SimulatorWindowOrientation is expected to be one of ${acceptableValues}. ` +
throw this.log.errorWithException(`SimulatorWindowOrientation is expected to be one of ${acceptableValues}. ` +
`'${prefs.SimulatorWindowOrientation}' is assigned instead.`);
}
}

if (!_.isUndefined(prefs.SimulatorWindowRotationAngle)) {
if (!_.isNumber(prefs.SimulatorWindowRotationAngle)) {
this.log.errorAndThrow(`SimulatorWindowRotationAngle is expected to be a valid number. ` +
throw this.log.errorWithException(`SimulatorWindowRotationAngle is expected to be a valid number. ` +
`'${prefs.SimulatorWindowRotationAngle}' is assigned instead.`);
}
}
Expand Down

0 comments on commit b01f113

Please sign in to comment.