Hush repetitive debug errors + remove from i18n

This commit is contained in:
infinite-persistence 2021-10-17 20:00:02 +08:00
parent 2a7f89d6b5
commit cfdfdce2fe
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
2 changed files with 13 additions and 10 deletions

View file

@ -469,11 +469,8 @@
"New --[clears Publish Form]--": "New", "New --[clears Publish Form]--": "New",
"Loading": "Loading", "Loading": "Loading",
"This file is in your library.": "This file is in your library.", "This file is in your library.": "This file is in your library.",
"'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.": "'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.",
"Invalid claim ID %s.": "Invalid claim ID %s.", "Invalid claim ID %s.": "Invalid claim ID %s.",
"'claimId' should no longer be used. Use 'streamClaimId' or 'channelClaimId' instead": "'claimId' should no longer be used. Use 'streamClaimId' or 'channelClaimId' instead",
"View Tag": "View Tag", "View Tag": "View Tag",
"'claimName' should no longer be used. Use 'streamClaimName' or 'channelClaimName' instead": "'claimName' should no longer be used. Use 'streamClaimName' or 'channelClaimName' instead",
"Vietnamese": "Vietnamese", "Vietnamese": "Vietnamese",
"Thai": "Thai", "Thai": "Thai",
"Arabic": "Arabic", "Arabic": "Arabic",
@ -486,7 +483,6 @@
"Greek": "Greek", "Greek": "Greek",
"Hide": "Hide", "Hide": "Hide",
"Persian": "Persian", "Persian": "Persian",
"'contentName' should no longer be used. Use 'streamName' instead": "'contentName' should no longer be used. Use 'streamName' instead",
"Sorry, we can't preview this file.": "Sorry, we can't preview this file.", "Sorry, we can't preview this file.": "Sorry, we can't preview this file.",
"View File": "View File", "View File": "View File",
"Close": "Close", "Close": "Close",

View file

@ -171,6 +171,15 @@ function parseURIModifier(modSeperator: ?string, modValue: ?string) {
return [claimId, claimSequence, bidPosition]; return [claimId, claimSequence, bidPosition];
} }
const errorHistory = [];
function logErrorOnce(err: string) {
if (!errorHistory.includes(err)) {
errorHistory.push(err);
console.error(err);
}
}
/** /**
* Takes an object in the same format returned by parse() and builds a URI. * Takes an object in the same format returned by parse() and builds a URI.
* *
@ -193,20 +202,18 @@ export function buildURI(UrlObj: LbryUrlObj, includeProto: boolean = true, proto
if (!isProduction) { if (!isProduction) {
if (claimId) { if (claimId) {
console.error(__("'claimId' should no longer be used. Use 'streamClaimId' or 'channelClaimId' instead")); logErrorOnce("'claimId' should no longer be used. Use 'streamClaimId' or 'channelClaimId' instead");
} }
if (claimName) { if (claimName) {
console.error(__("'claimName' should no longer be used. Use 'streamClaimName' or 'channelClaimName' instead")); logErrorOnce("'claimName' should no longer be used. Use 'streamClaimName' or 'channelClaimName' instead");
} }
if (contentName) { if (contentName) {
console.error(__("'contentName' should no longer be used. Use 'streamName' instead")); logErrorOnce("'contentName' should no longer be used. Use 'streamName' instead");
} }
} }
if (!claimName && !channelName && !streamName) { if (!claimName && !channelName && !streamName) {
console.error( console.error("'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.");
__("'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.")
);
} }
const formattedChannelName = channelName && (channelName.startsWith('@') ? channelName : `@${channelName}`); const formattedChannelName = channelName && (channelName.startsWith('@') ? channelName : `@${channelName}`);