Latest changes based on feedback
Signed-off-by: Andre Wanlin <andrewanlin@gmail.com>
This commit is contained in:
@@ -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}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user