Skip to content

Commit aeb0c5b

Browse files
authored
Merge pull request #171 from MartinBarker/taggerErrorLogging2
Tagger error logging2
2 parents 9b36ac5 + 0a97d99 commit aeb0c5b

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

app/(main)/tagger/page.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ export default function TaggerPage({ initialUrl }) {
3838
const [isLoadingFiles, setIsLoadingFiles] = useState(false);
3939
const [discogsError, setDiscogsError] = useState(null);
4040
const [tagsValue, setTagsValue] = useState('');
41+
42+
// Debug flag to show sample error message
43+
const errorDebug = false;
4144
const [tagsCopyState, setTagsCopyState] = useState('idle'); // idle | copied | hover
4245
const [hashtagsValue, setHashtagsValue] = useState('');
4346
const [hashtagsCopyState, setHashtagsCopyState] = useState('idle'); // idle | copied | hover
@@ -898,8 +901,10 @@ export default function TaggerPage({ initialUrl }) {
898901

899902
var route = `${apiBaseURL}/discogsFetch`;
900903

904+
// Clear any previous errors when starting a new request
905+
setDiscogsError(null);
906+
901907
try {
902-
setDiscogsError(null); // Clear any previous errors
903908
console.log(`🔍 [TAGGER] Starting Discogs fetch request:`, {
904909
url: urlToSubmit,
905910
parsedInfo: discogsInfo,
@@ -1062,8 +1067,8 @@ export default function TaggerPage({ initialUrl }) {
10621067
});
10631068

10641069
// Try to extract specific error details from the error message
1065-
// The error message format is: "HTTP 500: Internal Server Error - {details}"
1066-
const errorMatch = err.message.match(/HTTP 500: .* - (.+)/);
1070+
// The error message format is: "HTTP 500: [statusText] - {details}" or "HTTP 500: - {details}"
1071+
const errorMatch = err.message.match(/HTTP 500: .*? - (.+)/);
10671072
if (errorMatch) {
10681073
const errorDetails = errorMatch[1];
10691074
console.error(`📋 [TAGGER] Extracted error details:`, errorDetails);
@@ -2350,7 +2355,7 @@ export default function TaggerPage({ initialUrl }) {
23502355
Submit
23512356
</button>
23522357
</form>
2353-
{discogsError && (
2358+
{(discogsError || errorDebug) && (
23542359
<div
23552360
style={{
23562361
marginTop: '0.5rem',
@@ -2363,7 +2368,7 @@ export default function TaggerPage({ initialUrl }) {
23632368
fontWeight: '500'
23642369
}}
23652370
>
2366-
⚠️ {discogsError}
2371+
⚠️ {errorDebug ? 'Discogs API Rate Limit: Failed to fetch Discogs data for release/1258247 - Rate limit exceeded. Too many requests to Discogs API.' : discogsError}
23672372
</div>
23682373
)}
23692374
<div
@@ -3777,7 +3782,7 @@ export default function TaggerPage({ initialUrl }) {
37773782
placeholder={
37783783
hashtagsValue
37793784
? ''
3780-
: `#BookerT.Jones #PriscillaJones #BookerT&TheMGs #TheMar-Keys #TheStaxStaff #ThePackers #TheRCOAll-Stars #PriscillaCoolidge #BookerT.&Priscilla #1971 #France #TheWeddingSong #She #TheIndianSong #SeaGull #ForPriscilla #TheDeltaSong #Why #MississippiVoodoo #CoolBlackDream #SweetChildYoureNotAlone #BookerT.&Priscilla1971 #BookerT.Jones1971`
3785+
: `#BookerT.Jones #PriscillaJones #BookerT&TheMGs #TheMar-Keys #TheStaxStaff #ThePackers #TheRCOAll-Stars #PriscillaCoolidge #BookerT.&Priscilla #1971 #France #TheWeddingSong #She #TheIndianSong #SeaGull #ForPriscilla #TheDeltaSong #Why #MississippiVoodoo #CoolBlackDream #SweetChildYoureNotAlone #BookerT.&Priscilla1971 #BookerT.Jones1970`
37813786
}
37823787
rows={5}
37833788
style={{

0 commit comments

Comments
 (0)