Skip to content

Display field-specific server errors in instance create form #307

Closed as not planned

Description

@david-crespo

There are some API questions remaining to be resolved, but we would like to display errors in a relatively nice way on the instance create form.

Right now the API only gives one error at a time, and it's pretty barebones:

{
  "request_id": "56f2d804-4c19-4413-a062-588bc91a5c32",
  "error_code": null,
  "message": "unable to parse body: name requires at least one character at line 1 column 107"
}

Work on this ticket should probably wait until the API can give errors on multiple fields at once.

Activity

  1. added this to the 5/28 Demo milestone on Apr 27, 2021
  2. david-crespo commented on Apr 30, 2021

    @david-crespo
    CollaboratorAuthor

    Multi-field error responses probably aren't coming in the next month or so (see RFD 156), so we should make this work with what we have. Unblocked and added to the board.

  3. david-crespo commented on Apr 30, 2021

    @david-crespo
    CollaboratorAuthor

    On second thought, we may want to insist a small amount of API work be done before we get to this. Right now, if a field is invalid, we get

    {
      "request_id": "dddbb85b-371e-4c6a-a9c4-bb3bfa9a4baf",
      "error_code": null,
      "message": "unable to parse body: name must begin with an ASCII lowercase character at line 1 column 31"
    }

    but no structured indicator of which field it’s on. We can either temporarily hack this by pulling the first word after unable to parse body: (easy, really) or we can ask API to add a field key or something. Most or all validation issues should be caught client-side anyway, so we don't expect to see this very often.

    Another kind of error, one which we cannot catch client-side, is ObjectAlreadyExists.

    {
      "request_id": "b8787ca8-994d-4681-b637-cae8e8365f56",
      "error_code": "ObjectAlreadyExists",
      "message": "already exists: project \"abc\""
    }

    This response is similarly inadequate from the console point of view because it doesn't say which field(s) are relevant to the uniqueness check. We know it's name in the case of projects and instances, so we can deal with it that way (hard-coding the fact that ObjectAlreadyExists errors should show up on the name field) but it doesn't feel robust.

    Took this and #326 back off the board while we think about this.

  4. changed the title [-]Display server errors in instance create form[/-] [+]Display field-specific server errors in instance create form[/+] on May 3, 2021
  5. david-crespo commented on May 3, 2021

    @david-crespo
    CollaboratorAuthor

    Moved the part of this that's not blocked into #330

  6. removed this from the 5/28 Demo milestone on May 5, 2021
  7. david-crespo commented on Oct 21, 2022

    @david-crespo
    CollaboratorAuthor

    Not sure if we're going to get API support for this soon, but in any case this isn't really actionable until we do. Made an issue: oxidecomputer/omicron#1848 The closest we're going to get is using the generated Zod validators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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