Skip to content

Graceful errors on playground#2808

Merged
kzsb03 merged 21 commits intodevfrom
graceful-errors
Mar 12, 2026
Merged

Graceful errors on playground#2808
kzsb03 merged 21 commits intodevfrom
graceful-errors

Conversation

@tevanburen
Copy link
Copy Markdown
Contributor

@tevanburen tevanburen commented Mar 4, 2026

Description

Intercept some error messages from Playground and display their text with something more user-friendly

Changes Made

  • Set up yet another new field in the theme db, gracefulErrors, as a list of
{
 pattern: string;
 errorKey?: string;
 text?: string;
}
  • Add a hook, useGracefulErrors, that returns a function that converts errors to a graceful message. In this hook, check the theme db for a pattern that matches - if found, then either display the associated text, OR, if we have errorKey instead, then use that key to grab the message from shared/i18n - this allows for multi-language support, and for us to have standardized messages
  • Call the function when displaying errors during AskPlayground, and any errors shown in the room's "error box" (the red thing that comes up above the input component"

How to Test

  1. Get on this branch
  2. Modify AskPlayground such that it always throws an exception, for example
if (true) {
  throw new RuntimeException("abc");
}
  1. In a room, try sending a message - you should see it error with "abc"
  2. Navigate to update your theme at http://localhost:9090/SemossWeb/packages/client/dist/#/settings/admin-theme
  3. In the playground section, add
{
  "playground": {
    ...etc,
    "gracefulErrors": [
      {
        "pattern": "abc",
        "text": "This is an example of a graceful error"
      }
    ]
  }
}
  1. Save the theme
  2. In Playground, reload the page, then again try to chat
  3. Verify that "This is an example of a graceful error" appears in the toast and in the "error box"
  4. In your theme map, change the graceful error to
{
  "pattern": "abc",
  "errorKey": "overloaded"
}
  1. Save the theme
  2. In Playground, reload the page, then again try to chat
  3. Verify that "This model is unavailable right now. Please try a different model." appears in the toast and in the "error box"

Notes

There are a lot of random formatting changes, those are biome formatting from merges. Can be ignored

@tevanburen tevanburen self-assigned this Mar 4, 2026
@tevanburen tevanburen linked an issue Mar 4, 2026 that may be closed by this pull request
@tevanburen tevanburen marked this pull request as ready for review March 11, 2026 21:03
@tevanburen tevanburen requested a review from a team as a code owner March 11, 2026 21:03
@kzsb03 kzsb03 merged commit 9e4daa2 into dev Mar 12, 2026
6 checks passed
@kzsb03 kzsb03 deleted the graceful-errors branch March 12, 2026 21:05
@github-actions
Copy link
Copy Markdown

@CodiumAI-Agent /update_changelog

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display graceful error messages

2 participants