Skip to content

Commit

Permalink
fix: check currentValue before generating newValue
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Nov 24, 2021
1 parent f6454ba commit bb64598
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions lib/workers/repository/process/lookup/generate.ts
Expand Up @@ -32,19 +32,21 @@ export function generateUpdate(
}
}
const { currentValue } = config;
try {
update.newValue = versioning.getNewValue({
currentValue,
rangeStrategy,
currentVersion,
newVersion,
});
} catch (err) /* istanbul ignore next */ {
logger.warn(
{ err, currentValue, rangeStrategy, currentVersion, newVersion },
'getNewValue error'
);
update.newValue = currentValue;
if (currentValue) {
try {
update.newValue = versioning.getNewValue({
currentValue,
rangeStrategy,
currentVersion,
newVersion,
});
} catch (err) /* istanbul ignore next */ {
logger.warn(
{ err, currentValue, rangeStrategy, currentVersion, newVersion },
'getNewValue error'
);
update.newValue = currentValue;
}
}
update.newMajor = versioning.getMajor(newVersion);
update.newMinor = versioning.getMinor(newVersion);
Expand Down

0 comments on commit bb64598

Please sign in to comment.