Skip to content

Error message "you need to omit a field before deleting it" not descriptive enough #74

@sethreidnz

Description

@sethreidnz

Expected Behavior

I would expect the error message to tell me what field it is talking about.

"You need to omit a field before deleting it"

Actual Behavior

When you have an error about omitting a field before deleting it says:

"You need to omit a field before deleting it"

All you get is this with an empty details property:

"data": {
        "status": 400,
        "statusText": "Bad Request",
        "message": "You need to omit a field before deleting it",
        "details": {
        },
        "request": {
          "url": "https://api.contentful.com:443/spaces/knovuecdl43j/environments/master/content_types/learningPathModuleTutorialContent",
          "headers": {
            "Accept": "application/json, text/plain, */*",
            "Content-Type": "application/vnd.contentful.management.v1+json",
            "X-Contentful-User-Agent": "app contentful.cli/0.16.1; feature space-import; sdk contentful-management.js/5.2.1; platform node.js/v8.11.3; os macOS/17.7.0;",
            "Authorization": "Bearer ...8f825",
            "user-agent": "node.js/v8.11.3",
            "Accept-Encoding": "gzip",
            "X-Contentful-Version": 42,
            "Content-Length": 2783
          },
          "method": "put",
          "payloadData": "{\"displayField\":\"title\",\"name\":\"Learning Path Module Tutorial Content\",\"description\":\"Tutorial text based content for a learning path module\",\"fields\":[{\"id\":\"title\",\"name\":\"Title\",\"type\":\"Symbol\",\"localized\":false,\"required\":true,\"validations\":[],\"disabled\":false,\"omitted\":false},{\"id\":\"slug\",\"name\":\"Slug\",\"type\":\"Symbol\",\"localized\":false,\"required\":false,\"validations\":[{\"unique\":true},{\"regexp\":{\"pattern\":\"^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$\",\"flags\":null},\"message\":\"Slug must be one or more sequences of alphanumeric characters separated by a single -\"}],\"disabled\":false,\"omitted\":false},{\"id\":\"description\",\"name\":\"Description\",\"type\":\"Text\",\"localized\":false,\"required\":true,\"validations\":[{\"size\":{\"max\":600},\"message\":\"The description must be 600 or less characters\"}],\"disabled\":false,\"omitted\":false},{\"id\":\"minutesToComplete\",\"name\":\"Minutes to Complete\",\"type\":\"Integer\",\"localized\":false,\"required\":true,\"validations\":[],\"disabled\":false,\"omitted\":false},{\"id\":\"content\",\"name\":\"Content\",\"type\":\"Text\",\"localized\":false,\"required\":true,\"validations\":[],\"disabled\":false,\"omitted\":false},{\"id\":\"thumbnail\",\"name\":\"Thumbnail (955x395)\",\"type\":\"Link\",\"localized\":false,\"required\":false,\"validations\":[{\"assetImageDimensions\":{\"width\":{\"min\":955,\"max\":null},\"height\":{\"min\":395,\"max\":null}}}],\"disabled\":false,\"omitted\":false,\"linkType\":\"Asset\"},{\"id\":\"level\",\"name\":\"Level\",\"type\":\"Symbol\",\"localized\":false,\"required\":true,\"validations\":[{\"in\":[\"Beginner\",\"Intermediate\",\"Advanced\"]}],\"disabled\":false,\"omitted\":false},{\"id\":\"difficultyLevel\",\"name\":\"Difficulty Level\",\"type\":\"Link\",\"localized\":false,\"required\":false,\"validations\":[{\"linkContentType\":[\"contentLevel\"]}],\"disabled\":false,\"omitted\":false,\"linkType\":\"Entry\"},{\"id\":\"topics\",\"name\":\"Topics\",\"type\":\"Array\",\"localized\":false,\"required\":false,\"validations\":[],\"disabled\":false,\"omitted\":false,\"items\":{\"type\":\"Link\",\"validations\":[{\"linkContentType\":[\"learningPathTopic\"]}],\"linkType\":\"Entry\"}},{\"id\":\"publishToSites\",\"name\":\"Publish To Sites\",\"type\":\"Array\",\"localized\":false,\"required\":false,\"validations\":[],\"disabled\":false,\"omitted\":false,\"items\":{\"type\":\"Link\",\"validations\":[{\"linkContentType\":[\"siteId\"]}],\"linkType\":\"Entry\"}},{\"id\":\"summary\",\"name\":\"Summary\",\"type\":\"Text\",\"localized\":false,\"required\":false,\"validations\":[],\"disabled\":false,\"omitted\":false},{\"id\":\"repositoryUrl\",\"name\":\"Repository Url\",\"type\":\"Symbol\",\"localized\":false,\"required\":false,\"validations\":[],\"disabled\":false,\"omitted\":false},{\"id\":\"metaTitle\",\"name\":\"Meta Title\",\"type\":\"Symbol\",\"localized\":true,\"required\":false,\"validations\":[],\"disabled\":false,\"omitted\":false},{\"id\":\"metaDescription\",\"name\":\"Meta Description\",\"type\":\"Symbol\",\"localized\":true,\"required\":false,\"validations\":[],\"disabled\":false,\"omitted\":false}]}"
        },
        "requestId": "e57580e1d99c5d089811784e2feb186d"
      }

Possible Solution

Could it not say something like:

"You need to omit the field '{fieldName}' before deleting it"

Steps to Reproduce

  1. Create a content type with some fields
  2. Export and import it into another space
  3. Delete a field
  4. Export and import it again
  5. View error logs

Context

I'm trying to sync my content type development from a Development space into a Production space with ease.

Environment

  • Node:

8.11.3

  • NPM:

6.3.0

  • Operating System:

Darwin DESKTOP-AVV4EFJ 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64

  • CLI Version:

0.16.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions