@financial-times/cp-content-pipeline-schema 2.14.0 → 2.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,16 +17,25 @@ const resolvers = {
17
17
  try {
18
18
  return await context.dataSources.capi.getContent(args.uuid)
19
19
  } catch (error) {
20
- if (
21
- error instanceof BaseError &&
22
- error.data.upstreamStatusCode === 404
23
- ) {
24
- throw new HttpError({
25
- code: 'CONTENT_NOT_FOUND',
26
- message: `Content ${args.uuid} not found in Content API`,
27
- statusCode: 404,
28
- relatesToSystems: ['up-ica'],
29
- })
20
+ if (error instanceof BaseError) {
21
+ if (error.data.upstreamStatusCode === 404) {
22
+ throw new HttpError({
23
+ code: 'CONTENT_NOT_FOUND',
24
+ message: 'Content not found in Content API',
25
+ cause: error,
26
+ uuid: args.uuid,
27
+ statusCode: 404,
28
+ relatesToSystems: ['up-ica'],
29
+ })
30
+ }
31
+ if (error.code === 'UNEXPECTED_CONTENT_TYPE') {
32
+ throw new HttpError({
33
+ code: error.code,
34
+ cause: error,
35
+ message: `Requested a content type we don't handle`,
36
+ statusCode: 404,
37
+ })
38
+ }
30
39
  }
31
40
 
32
41
  throw error