Bump version to 1.4.1 and tighten client handling
This commit is contained in:
@@ -399,7 +399,14 @@
|
||||
}).then(function (response) {
|
||||
if (!response.ok) {
|
||||
return response.text().then(function (text) {
|
||||
throw new Error(text || 'Unable to rename client.');
|
||||
var message = text || 'Unable to rename client.';
|
||||
try {
|
||||
var payload = JSON.parse(text);
|
||||
message = payload && (payload.error || payload.message) ? String(payload.error || payload.message) : message;
|
||||
} catch (_error) {
|
||||
// fall back to the raw text body
|
||||
}
|
||||
throw new Error(message);
|
||||
});
|
||||
}
|
||||
return response.json().catch(function () {
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
function getMessageVariant(message, fallbackVariant) {
|
||||
var text = String(message || '').trim();
|
||||
if (/^(unable to delete|cannot delete|can't delete)/i.test(text)) {
|
||||
if (/^(unable to delete|cannot delete|can't delete)|\bstill (?:in use|linked|assigned|used)\b/i.test(text)) {
|
||||
return 'danger';
|
||||
}
|
||||
return String(fallbackVariant || 'success').trim().toLowerCase() || 'success';
|
||||
|
||||
Reference in New Issue
Block a user