everydaycats commited on
Commit
ec05ee9
·
verified ·
1 Parent(s): 985ea6c

Update app.js

Browse files
Files changed (1) hide show
  1. app.js +7 -1
app.js CHANGED
@@ -92,7 +92,13 @@ async function checkMinimumCredits(userId, type = 'basic') {
92
  const required = type === 'diamond' ? MIN_DIAMOND_REQUIRED : MIN_BASIC_REQUIRED;
93
 
94
  if (credits < required) {
95
- throw new Error(`Insufficient ${type} credits. You have ${credits}, need minimum ${required} to proceed.`);
 
 
 
 
 
 
96
  }
97
  }
98
 
 
92
  const required = type === 'diamond' ? MIN_DIAMOND_REQUIRED : MIN_BASIC_REQUIRED;
93
 
94
  if (credits < required) {
95
+
96
+ res.status(500).json({
97
+ insufficient: true,
98
+ error:`Insufficient ${type} credits. You have ${credits}, need minimum ${required} to proceed.`;
99
+
100
+ });
101
+ // throw new Error(`Insufficient ${type} credits. You have ${credits}, need minimum ${required} to proceed.`);
102
  }
103
  }
104