mirror of
https://github.com/Dictionarry-Hub/profilarr.git
synced 2026-01-25 20:32:26 +01:00
feat: enhance logging and error handling in various components for improved debugging
This commit is contained in:
@@ -265,6 +265,7 @@ const createSpecialEndpoint = (category, endpoint) => async data => {
|
||||
try {
|
||||
validateResourceName('category', category);
|
||||
validatePath([category, endpoint]);
|
||||
console.log(`Sending data to ${endpoint}:`, data);
|
||||
const response = await axios.post(
|
||||
`${BASE_URL}/${category}/${endpoint}`,
|
||||
data
|
||||
|
||||
@@ -19,15 +19,12 @@ function FormatCard({
|
||||
const passRate = Math.round((passedTests / totalTests) * 100) || 0;
|
||||
|
||||
const getConditionStyle = condition => {
|
||||
if (condition.required && condition.negate) {
|
||||
return 'bg-orange-100 border-orange-200 text-orange-700 dark:bg-orange-900/30 dark:border-orange-700 dark:text-orange-300';
|
||||
if (condition.negate) {
|
||||
return 'bg-red-100 border-red-200 text-red-700 dark:bg-red-900/30 dark:border-red-700 dark:text-red-300';
|
||||
}
|
||||
if (condition.required) {
|
||||
return 'bg-green-100 border-green-200 text-green-700 dark:bg-green-900/30 dark:border-green-700 dark:text-green-300';
|
||||
}
|
||||
if (condition.negate) {
|
||||
return 'bg-red-100 border-red-200 text-red-700 dark:bg-red-900/30 dark:border-red-700 dark:text-red-300';
|
||||
}
|
||||
return 'bg-blue-100 border-blue-200 text-blue-700 dark:bg-blue-900/30 dark:border-blue-700 dark:text-blue-300';
|
||||
};
|
||||
|
||||
@@ -43,9 +40,9 @@ function FormatCard({
|
||||
|
||||
if (sortedConditions.length <= 5) return sortedConditions;
|
||||
|
||||
// Take first 4 conditions and add a count of remaining ones
|
||||
const displayConditions = sortedConditions.slice(0, 4);
|
||||
const remainingCount = sortedConditions.length - 4;
|
||||
// Take first 6 conditions and add a count of remaining ones
|
||||
const displayConditions = sortedConditions.slice(0, 6);
|
||||
const remainingCount = sortedConditions.length - 6;
|
||||
|
||||
// Add a virtual condition for the count
|
||||
displayConditions.push({
|
||||
|
||||
@@ -68,7 +68,7 @@ const RegexModal = ({
|
||||
} catch (error) {
|
||||
console.error('Error deleting pattern:', error);
|
||||
Alert.error(
|
||||
error.message ||
|
||||
error.response?.data?.error ||
|
||||
'Failed to delete pattern. Please try again.'
|
||||
);
|
||||
} finally {
|
||||
|
||||
@@ -224,10 +224,10 @@ export const useFormatModal = (initialFormat, onSuccess) => {
|
||||
} catch (error) {
|
||||
console.error('Error deleting format:', error);
|
||||
Alert.error(
|
||||
error.message ||
|
||||
error.response?.data?.error ||
|
||||
'Failed to delete format. Please try again.'
|
||||
);
|
||||
setIsDeleting(false); // Reset delete state on error
|
||||
setIsDeleting(false);
|
||||
}
|
||||
} else {
|
||||
setIsDeleting(true);
|
||||
|
||||
Reference in New Issue
Block a user