Skip to content

Commit eb6f661

Browse files
authored
Merge pull request #455 from impresso/develop
Release v3.0.7
2 parents 9c50712 + 9b31231 commit eb6f661

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/services/impresso-ner/impresso-ner.class.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ export class ImpressoNerService {
172172
if (response.statusCode !== 200) {
173173
let bodyText = ''
174174
try {
175-
bodyText = await response.body.text()
175+
bodyText = String(await response.body.text())
176176
} catch {
177177
/* ignore */
178178
}
179179

180-
logger.error(`Failed to fetch downstream data. Error (${response.statusCode}): `, bodyText)
180+
logger.error(`Failed to fetch downstream data. Error (${response.statusCode}): ${bodyText}`)
181181
throw new Error('Failed to fetch downstream data')
182182
}
183183

src/util/json.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ ajv.addSchema(require('../services/entity-mentions-timeline/schema/create/respon
3535
const BaseSchemaURI = 'https://github.com/impresso/impresso-middle-layer/tree/master/src'
3636

3737
function validated(obj, schemaUri) {
38-
const uri = schemaUri.startsWith('http') ? schemaUri : `${BaseSchemaURI}/${schemaUri}`
38+
const uri = schemaUri?.startsWith('http') ? schemaUri : `${BaseSchemaURI}/${schemaUri}`
3939
const validate = ajv.getSchema(uri)
4040

4141
if (validate === undefined) {
@@ -54,7 +54,7 @@ function validated(obj, schemaUri) {
5454
function formatValidationErrors(errors) {
5555
return (errors || [])
5656
.map(error => {
57-
const dataPath = error.dataPath.startsWith('.') ? error.dataPath.slice(1) : error.dataPath
57+
const dataPath = error.dataPath?.startsWith('.') ? error.dataPath?.slice(1) : error.dataPath
5858

5959
if (error.keyword === 'additionalProperties') {
6060
const currentPath = dataPath

src/util/jsonschema.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ajv.addSchema(require('../schema/find.json'))
99
ajv.addSchema(require('../schema/addons.json'))
1010

1111
function validated(obj, schemaUri) {
12-
const uri = schemaUri.startsWith('http') ? schemaUri : `${BaseSchemaURI}/${schemaUri}`
12+
const uri = schemaUri?.startsWith('http') ? schemaUri : `${BaseSchemaURI}/${schemaUri}`
1313
const validate = ajv.getSchema(uri)
1414

1515
if (validate === undefined) {

src/util/queryParameters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { protobuf } from 'impresso-jscommons'
33

44
export const parseOrderBy = (orderBy: string, keyFieldMap: Record<string, string> = {}) => {
55
if (orderBy == null) return []
6-
const isDescending = orderBy.startsWith('-')
6+
const isDescending = orderBy?.startsWith('-')
77
const orderKey = orderBy.replace(/^-/, '')
88
const field = keyFieldMap[orderKey]
99
return field != null ? [field, isDescending] : []

0 commit comments

Comments
 (0)