Add option to hide buildUri warnings

No point for it to keep appearing if nobody cares?

Anyway, added option to hide it via environment variable for those who are annoyed by it.
This commit is contained in:
infinite-persistence 2021-11-03 12:56:57 +08:00
parent 3d1d448afb
commit 7b621b7417
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0

View file

@ -200,6 +200,7 @@ export function buildURI(UrlObj: LbryUrlObj, includeProto: boolean = true, proto
} = UrlObj; } = UrlObj;
const { claimId, claimName, contentName } = deprecatedParts; const { claimId, claimName, contentName } = deprecatedParts;
// @ifndef IGNORE_BUILD_URI_WARNINGS
if (!isProduction) { if (!isProduction) {
if (claimId) { if (claimId) {
logErrorOnce("'claimId' should no longer be used. Use 'streamClaimId' or 'channelClaimId' instead"); logErrorOnce("'claimId' should no longer be used. Use 'streamClaimId' or 'channelClaimId' instead");
@ -211,6 +212,7 @@ export function buildURI(UrlObj: LbryUrlObj, includeProto: boolean = true, proto
logErrorOnce("'contentName' should no longer be used. Use 'streamName' instead"); logErrorOnce("'contentName' should no longer be used. Use 'streamName' instead");
} }
} }
// @endif
if (!claimName && !channelName && !streamName) { if (!claimName && !channelName && !streamName) {
console.error("'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url."); console.error("'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.");