mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
fix(scripts): better error handling for script runner and GDPR
This commit is contained in:
@@ -17,12 +17,12 @@ function setUpServer () {
|
||||
setUpServer();
|
||||
|
||||
// Replace this with your migration
|
||||
const processUsers = require('./users/takeThis.js');
|
||||
const processUsers = require('../scripts/gdpr-delete-users.js');
|
||||
processUsers()
|
||||
.then(function success () {
|
||||
process.exitCode = 0;
|
||||
process.exit(0);
|
||||
})
|
||||
.catch(function failure (err) {
|
||||
console.log(err);
|
||||
process.exitCode = 1;
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
@@ -20,9 +20,11 @@ async function _deleteAmplitudeData (userId, email) {
|
||||
password: AMPLITUDE_SECRET,
|
||||
},
|
||||
}
|
||||
);
|
||||
).catch((err) => {
|
||||
console.log(err.response.data);
|
||||
});
|
||||
|
||||
console.log(`${response.status} ${response.statusText}`);
|
||||
if (response) console.log(`${response.status} ${response.statusText}`);
|
||||
}
|
||||
|
||||
async function _deleteHabiticaData (user) {
|
||||
@@ -44,10 +46,14 @@ async function _deleteHabiticaData (user) {
|
||||
'x-api-key': user.apiToken,
|
||||
},
|
||||
}
|
||||
);
|
||||
).catch((err) => {
|
||||
console.log(err.response.data);
|
||||
});
|
||||
|
||||
console.log(`${response.status} ${response.statusText}`);
|
||||
if (response.status === 200) console.log(`${user._id} removed. Last login: ${user.auth.timestamps.loggedin}`);
|
||||
if (response) {
|
||||
console.log(`${response.status} ${response.statusText}`);
|
||||
if (response.status === 200) console.log(`${user._id} removed. Last login: ${user.auth.timestamps.loggedin}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function _processEmailAddress (email) {
|
||||
|
||||
Reference in New Issue
Block a user