Uploaded image for project: 'AeroGear'
  1. AeroGear
  2. AEROGEAR-8143

[MDC] Improve error handling and allow message customization

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • None
    • None
    • None

      Current situation

      There is only simple HTTP 500 request with error message in the body returned to the client.

      Why

      We can't customize error messages on the client side.

      Proposed solution

      Error message on the MDC backend contains more information, pass some of it to the client and allow for custom handling of that. Especially fields Status and Reason.

      examples:

      Unable to find source-code formatter for language: golang. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      &errors.StatusError{ErrStatus:v1.Status{TypeMeta:v1.TypeMeta{Kind:\"Status\", APIVersion:\"v1\"}, ListMeta:v1.ListMeta{SelfLink:\"\", ResourceVersion:\"\", Continue:\"\"}, Status:\"Failure\", Message:\"mobileclients.mobile.k8s.io \\\"bezas\\\" already exists\", Reason:\"AlreadyExists\", Details:(*v1.StatusDetails)(0xc4200a7500), Code:409}}
      
      Unable to find source-code formatter for language: golang. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      &errors.StatusError{ErrStatus:v1.Status{TypeMeta:v1.TypeMeta{Kind:\"Status\", APIVersion:\"v1\"}, ListMeta:v1.ListMeta{SelfLink:\"\", ResourceVersion:\"\", Continue:\"\"}, Status:\"Failure\", Message:\"MobileClient.mobile.k8s.io \\\"&^%&%\\\" is invalid: [metadata.name: Invalid value: \\\"&^%&%\\\": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'), []: Invalid value: map[string]interface {}{\\\"metadata\\\":map[string]interface {}{\\\"name\\\":\\\"&^%&%\\\", \\\"namespace\\\":\\\"myproject\\\", \\\"creationTimestamp\\\":\\\"2018-11-23T11:06:43Z\\\", \\\"generation\\\":1, \\\"uid\\\":\\\"dc7fd8fb-ef0f-11e8-9b75-0af08791569c\\\", \\\"selfLink\\\":\\\"\\\", \\\"clusterName\\\":\\\"\\\"}, \\\"spec\\\":map[string]interface {}{\\\"apiKey\\\":\\\"f9e40fa9-bd0e-48c1-bf65-2719d0774e00\\\", \\\"dmzUrl\\\":\\\"\\\", \\\"name\\\":\\\"&^%&%\\\"}, \\\"status\\\":map[string]interface {}{\\\"services\\\":interface {}(nil)}, \\\"apiVersion\\\":\\\"mobile.k8s.io/v1alpha1\\\", \\\"kind\\\":\\\"MobileClient\\\"}: validation failure list:\\nspec.name in body should match '([\\\\w-])']\", Reason:\"Invalid\", Details:(*v1.StatusDetails)(0xc42014aa80), Code:422}}
      

      Customize Create New App error message for already existing app name.

      • Show a better message when user tries to create an app with a duplicate name. Current message is "mobileclients.mobile.k8s.io "myapp" already exists"

              mziccard Massimiliano Ziccardi
              vsazel Vojtěch Sázel (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: