Improve output (around "Requested ... version") when we know input (#368)

542d9a8 · Paulo F. Oliveira · 2026-02-28 14:07

2 files +30 -10
Message
{commit_body(@commit)}

Files changed

modified dist/index.js
+15 −5
@@ -26066,11 +26066,21 @@ async function getOTPVersion(otpSpec0, osVersion) {
26066 26066 }
26067 26067
26068 26068 function requestedVersionFor(tool, version, originListing, mirrors) {
26069 return (
26070 `Requested ${tool} version (${version}) not found in version list, ` +
26071 `at ${originListing}${mirrors ? `, with mirrors ${mirrors}` : ''}; ` +
26072 "should you be using option 'version-type': 'strict'?"
26073 )
26069 + const isStrictVersion = isStrictVersion()
26070 +
26071 + let versionType = 'loose'
26072 + if (isStrictVersion) {
26073 + versionType = 'strict'
26074 + }
26075 +
26076 + let ret =
26077 + `Requested ${versionType} ${tool} version (${version}) not found in version list, ` +
26078 + `at ${originListing}${mirrors ? `, with mirrors ${mirrors}` : ''}.`
26079 + if (!isStrictVersion) {
26080 + ret = `${ret} Should you be using option 'version-type': 'strict'?`
26081 + }
26082 +
26083 + return ret
26074 26084 }
26075 26085
26076 26086 const knownBranches = ['main', 'master', 'maint']
modified src/setup-beam.js
+15 −5
@@ -191,11 +191,21 @@ async function getOTPVersion(otpSpec0, osVersion) {
191 191 }
192 192
193 193 function requestedVersionFor(tool, version, originListing, mirrors) {
194 return (
195 `Requested ${tool} version (${version}) not found in version list, ` +
196 `at ${originListing}${mirrors ? `, with mirrors ${mirrors}` : ''}; ` +
197 "should you be using option 'version-type': 'strict'?"
198 )
194 + const isStrictVersion = isStrictVersion()
195 +
196 + let versionType = 'loose'
197 + if (isStrictVersion) {
198 + versionType = 'strict'
199 + }
200 +
201 + let ret =
202 + `Requested ${versionType} ${tool} version (${version}) not found in version list, ` +
203 + `at ${originListing}${mirrors ? `, with mirrors ${mirrors}` : ''}.`
204 + if (!isStrictVersion) {
205 + ret = `${ret} Should you be using option 'version-type': 'strict'?`
206 + }
207 +
208 + return ret
199 209 }
200 210
201 211 const knownBranches = ['main', 'master', 'maint']

Parents: b764149