Skip to content

Commit

Permalink
Fix Server Error Parsing (#546)
Browse files Browse the repository at this point in the history
* Update GuidedSourceData.js

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update GuidedSourceData.js

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
garrettmflynn and pre-commit-ci[bot] authored Dec 28, 2023
1 parent e1a9199 commit 2b547be
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,11 @@ export class GuidedSourceDataPage extends ManagedPage {
if (isStorybook) return;

if (result.message) {
const [
type,
text = `<small><pre>${result.traceback
.trim()
.split("\n")
.slice(-2)[0]
.trim()}</pre></small>`,
] = result.message.split(":");
const [type, ...splitText] = result.message.split(":");
const text = splitText.length
? splitText.join(":").replaceAll("<", "&lt").replaceAll(">", "&gt")
: `<small><pre>${result.traceback.trim().split("\n").slice(-2)[0].trim()}</pre></small>`;

const message = `<h4 style="margin: 0;">Request Failed</h4><small>${type}</small><p>${text}</p>`;
this.notify(message, "error");
throw result;
Expand Down

0 comments on commit 2b547be

Please sign in to comment.