Skip to content

Improve tag rename error handling & messages#1852

Merged
Oaphi merged 11 commits intodevelopfrom
0valt/tags
Oct 4, 2025
Merged

Improve tag rename error handling & messages#1852
Oaphi merged 11 commits intodevelopfrom
0valt/tags

Conversation

@Oaphi
Copy link
Member

@Oaphi Oaphi commented Sep 28, 2025

closes #1851

Also fixes an old bug preventing validation for tags with spaces from taking effect.

Error notification when the new tag name contains spaces:

Screenshot from 2025-09-29 14-21-04

Error notification when the new tag name matches an already existing tag:

Screenshot from 2025-09-29 14-21-14

As a treat, it also ensures old tag names are quoted in the rename prompt (on a tangent, we should move from a prompt to a proper modal dialog, but this is outside of the scope of this PR):

image

Compared to how it is now:

Screenshot from 2025-09-28 12-52-15

Finally, it also changes error handling for tag creation (see #1852 (comment)) a bit:

  • removes duplicate error flashes after failing to create tags;

  • improves the combined error message shown upon failure to create a tag (no actual changes, just a nice side-effect of other changes):

    Screenshot from 2025-09-29 14-52-59

@Oaphi Oaphi requested review from a team and cellio September 28, 2025 07:25
@Oaphi Oaphi added this to the v0.12.4 milestone Sep 28, 2025
@codecov
Copy link

codecov bot commented Sep 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.29%. Comparing base (1801e96) to head (b1f86f6).
⚠️ Report is 54 commits behind head on develop.

Additional details and impacted files
Components Coverage Δ
controllers 72.30% <ø> (+0.04%) ⬆️
helpers 82.43% <ø> (ø)
jobs 60.86% <ø> (ø)
models 89.20% <100.00%> (+<0.01%) ⬆️
tasks 61.11% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Oaphi Oaphi requested a review from ArtOfCode- September 28, 2025 10:05
@cellio
Copy link
Member

cellio commented Sep 28, 2025

Whatever we're doing to make nicer error messages, we might want to also apply to tag creation if that's easy. This is from the "new tag" button on the tags page:

Name Tag names may not contain spaces

Also, I don't know if this is something about a dev environment or something else, but for one of the two errors from the rename path, I got an error message with a timestamp in it:

Screenshot

The other one was as shown in the description.

@Oaphi Oaphi changed the title Improve duplicate tag rename message Improve tag rename error handling & messages Sep 29, 2025
Comment on lines +435 to +452
if(isFailed) {
const { errors = [], message } = data;

if (message) {
const fullMessage =
errors.length > 1
? `${message}:<ul>${errors.map((e) => `<li>${e.trim()}</li>`).join('')}</ul>`
: errors.length === 1
? `${message} (${errors[0].toLowerCase().trim()})`
: message;

QPixel.createNotification('danger', fullMessage);
}
else {
for (const error of errors) {
QPixel.createNotification('danger', error);
}
}
Copy link
Member Author

@Oaphi Oaphi Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic for handling failed responses is as follows:

  • If only the message field is present, show it directly;
  • If only the errors field is present, create a notification for each error listed;
  • If both message and errors are present:
    • if only one error is present, append a lowercase version of it in parentheses (<message> (<error>));
    • otherwise, use message as the notification's header and display errors as an unordered list (matches what our flash logic does);

@Oaphi
Copy link
Member Author

Oaphi commented Sep 29, 2025

Also, I don't know if this is something about a dev environment or something else, but for one of the two errors from the rename path, I got an error message with a timestamp in it:

@cellio IIRC, the timestamp is shown when there's already an error notification present on the page - see createNotification in the client-side API. We should make it prettier, but that's a bit out of scope for this PR.

@Oaphi Oaphi requested a review from ArtOfCode- September 29, 2025 11:54
@cellio
Copy link
Member

cellio commented Sep 29, 2025

@cellio IIRC, the timestamp is shown when there's already an error notification present on the page - see createNotification in the client-side API. We should make it prettier, but that's a bit out of scope for this PR.

Ah, ok! If this PR didn't add it, then definitely don't do anything about it here. And maybe not at all; I didn't realize the connection to the other error that was already on the page, and in that rare case it does seem useful to distinguish somehow. Let's leave it alone.

Copy link
Member

@cellio cellio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with latest changes. LGTM. Didn't code-review JS.

@Oaphi Oaphi merged commit 7f107ed into develop Oct 4, 2025
13 checks passed
@Oaphi Oaphi deleted the 0valt/tags branch October 4, 2025 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error message for failed tag renames

3 participants