carbon-design-system / carbon-platform

The "next" version of the Carbon Design System website, as a platform.
https://next.carbondesignsystem.com
Apache License 2.0
21 stars 5 forks source link

MDX error handling UI/UX #818

Closed mattrosno closed 2 years ago

mattrosno commented 2 years ago

When there are remote MDX errors, how do we handle those in the page? For example:

  1. Entire page breaks and nothing can be rendered
  2. Page attempts to use an unsupported MDX component
  3. Page uses an MDX component that's supported but has errors and can't be rendered

Joe's Notes

Possible Errors

Options

Consolidated error categories for design consideration

  1. Errors propagated from the underlying MDX library (i.e. parsing errors)
    1. markdown parsing errors
    2. jsx parsing errors
    3. usage of an unknown token somewhere in the markdown
  2. Unsupported things
    1. import statements
    2. unsupported/unknown components
    3. comments
    4. unsupported frontmatter
  3. "This" versus "that" preferences
    1. using string styles on components instead of object styles
    2. using a "wrong" type of image component
    3. using tabs frontmatter instead of schema file docs definitions
mattrosno commented 2 years ago

Hey team! Please add your planning poker estimate with ZenHub @aubrey-oneal @kingtraceyj

jharvey10 commented 2 years ago

Notes from dev + design discussion:

General philosophy

Convert each category 2 and 3 error into an inline notification with a corrective action. Potentially linking out to an FAQ or help document with common errors and how to resolve them. Where appropriate (and concise), add a related code snippet below the inline notification showing the problematic MDX.

We will strive towards two separate experiences: dev mode and prod mode. In dev mode, all errors will be presented to the user. In prod mode, we will revisit this and decide what makes sense to show on the live website for still-malformed MDX.

For non-recoverable full-page errors, the concept is the same. Show an inline notification at the top of the page with some details about what happened, potentially with a related code snippet if one is available from the output of the MDX parser.

kingtraceyj commented 2 years ago

@jdharvey-ibm and @alisonjoseph do you mind sharing some screenshots of a few examples? maybe one of an inline error and then one of a full page error?

jharvey10 commented 2 years ago

@francinelucca may be able to help out with the error texts. At the moment, I don't think we have any UI demonstrating the errors, but we can definitely get you some of the error text we'd expect to get emitted for each type of error.

kingtraceyj commented 2 years ago

sample error text would be great!

francinelucca commented 2 years ago

will gather info and update here by EOD

francinelucca commented 2 years ago

@kingtraceyj errors:

Inline styles that are strings instead of objects

image

Inclusion of HTML comments

image

General Markdown parsing errors

image

General JSX parsing errors

image