Skip to content

Improve invalid input error handling and printing #1075

@jooola

Description

@jooola

TL;DR

We currently print the invalid input errors the same way we print all other errors.

The invalid input error holds additional details about the reasons why the invalid input error occurred, this data is not shown to the users.

$ hcloud server create --name "a a" --image debian-12 --type cpx11
hcloud: invalid input in field 'name' (invalid_input, 6ea253683232ea88)

Expected behavior

Handle invalid input errors and print all the details for the users to fully understand why the invalid input error failed. Below is an example of invalid input error with the details:

{
  "error": {
    "message": "invalid input in field 'name'",
    "code": "invalid_input",
    "details": {
      "fields": [
        {
          "name": "name",
          "messages": [
            "Name must be a valid hostname."
          ]
        }
      ]
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions