Skip to content

Commit

Permalink
fix: better error message
Browse files Browse the repository at this point in the history
(cherry picked from commit 54a8389)
  • Loading branch information
barredterra authored and mergify[bot] committed Mar 4, 2024
1 parent b79f133 commit b94e978
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions frappe/public/js/frappe/list/bulk_operations.js
Expand Up @@ -225,9 +225,17 @@ export default class BulkOperations {
})
.then((failed) => {
if (failed?.length) {
frappe.throw(
__("Cannot {0} {1}", [action, failed.map((f) => f.bold()).join(", ")])
);
const comma_separated_records = frappe.utils.comma_and(failed);
switch (action) {
case "submit":
frappe.throw(__("Cannot submit {0}.", [comma_separated_records]));
break;
case "cancel":
frappe.throw(__("Cannot cancel {0}.", [comma_separated_records]));
break;
default:
frappe.throw(__("Cannot {0} {1}.", [action, comma_separated_records]));
}
}
if (failed?.length < docnames.length) {
frappe.utils.play_sound(action);
Expand Down

0 comments on commit b94e978

Please sign in to comment.