Latest changes based on feedback

Signed-off-by: Andre Wanlin <andrewanlin@gmail.com>
This commit is contained in:
Andre Wanlin
2023-05-02 15:35:25 -05:00
parent 0f439d6508
commit b66092c134
3 changed files with 4 additions and 3 deletions
+2
View File
@@ -2,6 +2,8 @@
'@backstage/plugin-linguist-backend': patch
---
**BREAKING**: Removed public constructor from `LinguistBackendApi`. Removed export of `LinguistBackendDatabase` and `LinguistBackendDatabase`
Several improvements to the Linguist backend have been made:
- Added tests for the `LinguistBackendDatabase` and `LinguistBackendApi`
@@ -170,7 +170,6 @@ export class LinguistBackendClient implements LinguistBackendApi {
try {
await this.generateEntityLanguages(entityRef, url);
} catch (error) {
console.log(error);
assertError(error);
this.logger.error(
`Unable to process "${entityRef}" using "${url}", message: ${error.message}, stack: ${error.stack}`,
@@ -93,7 +93,7 @@ export class LinguistBackendDatabase implements LinguistBackendStore {
.where({ entity_ref: entityRef })
.first();
if (!entityResults) {
if (!entityResults || !entityResults.languages) {
const emptyResults: Languages = {
languageCount: 0,
totalBytes: 0,
@@ -104,7 +104,7 @@ export class LinguistBackendDatabase implements LinguistBackendStore {
}
try {
return JSON.parse(entityResults.languages as string);
return JSON.parse(entityResults.languages);
} catch (error) {
throw new Error(`Failed to parse languages for '${entityRef}', ${error}`);
}