Fix some issues on Harvest-Node

This commit is contained in:
Jan Oberhauser
2020-01-29 15:51:14 -08:00
parent d752b555bb
commit e05b46c7e6
10 changed files with 308 additions and 301 deletions

View File

@@ -60,13 +60,13 @@ export async function harvestApiRequest(
throw new Error('The Harvest credentials are not valid!');
}
if (error.error && error.error.error_summary) {
if (error.error && error.error.message) {
// Try to return the error prettier
throw new Error(`Harvest error response [${error.statusCode}]: ${error.error.error_summary}`);
throw new Error(`Harvest error response [${error.statusCode}]: ${error.error.message}`);
}
// If that data does not exist for some reason return the actual error
throw error;
throw new Error(`Harvest error response: ${error.message}`);
}
}