File tree Expand file tree Collapse file tree 4 files changed +6
-6
lines changed Expand file tree Collapse file tree 4 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -172,12 +172,12 @@ export class ImpressoNerService {
172
172
if ( response . statusCode !== 200 ) {
173
173
let bodyText = ''
174
174
try {
175
- bodyText = await response . body . text ( )
175
+ bodyText = String ( await response . body . text ( ) )
176
176
} catch {
177
177
/* ignore */
178
178
}
179
179
180
- logger . error ( `Failed to fetch downstream data. Error (${ response . statusCode } ): ` , bodyText )
180
+ logger . error ( `Failed to fetch downstream data. Error (${ response . statusCode } ): ${ bodyText } ` )
181
181
throw new Error ( 'Failed to fetch downstream data' )
182
182
}
183
183
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ ajv.addSchema(require('../services/entity-mentions-timeline/schema/create/respon
35
35
const BaseSchemaURI = 'https://github.com/impresso/impresso-middle-layer/tree/master/src'
36
36
37
37
function validated ( obj , schemaUri ) {
38
- const uri = schemaUri . startsWith ( 'http' ) ? schemaUri : `${ BaseSchemaURI } /${ schemaUri } `
38
+ const uri = schemaUri ? .startsWith ( 'http' ) ? schemaUri : `${ BaseSchemaURI } /${ schemaUri } `
39
39
const validate = ajv . getSchema ( uri )
40
40
41
41
if ( validate === undefined ) {
@@ -54,7 +54,7 @@ function validated(obj, schemaUri) {
54
54
function formatValidationErrors ( errors ) {
55
55
return ( errors || [ ] )
56
56
. 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
58
58
59
59
if ( error . keyword === 'additionalProperties' ) {
60
60
const currentPath = dataPath
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ ajv.addSchema(require('../schema/find.json'))
9
9
ajv . addSchema ( require ( '../schema/addons.json' ) )
10
10
11
11
function validated ( obj , schemaUri ) {
12
- const uri = schemaUri . startsWith ( 'http' ) ? schemaUri : `${ BaseSchemaURI } /${ schemaUri } `
12
+ const uri = schemaUri ? .startsWith ( 'http' ) ? schemaUri : `${ BaseSchemaURI } /${ schemaUri } `
13
13
const validate = ajv . getSchema ( uri )
14
14
15
15
if ( validate === undefined ) {
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { protobuf } from 'impresso-jscommons'
3
3
4
4
export const parseOrderBy = ( orderBy : string , keyFieldMap : Record < string , string > = { } ) => {
5
5
if ( orderBy == null ) return [ ]
6
- const isDescending = orderBy . startsWith ( '-' )
6
+ const isDescending = orderBy ? .startsWith ( '-' )
7
7
const orderKey = orderBy . replace ( / ^ - / , '' )
8
8
const field = keyFieldMap [ orderKey ]
9
9
return field != null ? [ field , isDescending ] : [ ]
You can’t perform that action at this time.
0 commit comments