Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions lang/ui.ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,6 @@
"unexpected-error-description": {
"defaultMessage": "Si us plau, torna-ho a provar o <link>plantejar una solicitud de suport</link> ."
},
"unexpected-error-title": {
"defaultMessage": "Si us plau, torna-ho a provar o <link>plantejar una solicitud de suport</link>."
},
"untitled-project": {
"defaultMessage": "Projecte sense títol"
},
Expand Down
3 changes: 0 additions & 3 deletions lang/ui.de.json
Original file line number Diff line number Diff line change
Expand Up @@ -836,9 +836,6 @@
"unexpected-error-description": {
"defaultMessage": "Bitte versuche es erneut oder <link>stelle eine Supportanfrage</link>"
},
"unexpected-error-title": {
"defaultMessage": "Bitte versuche es erneut, oder <link>stelle eine Supportanfrage</link>"
},
"untitled-project": {
"defaultMessage": "Unbenanntes Projekt"
},
Expand Down
4 changes: 2 additions & 2 deletions lang/ui.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1135,8 +1135,8 @@
"description": "Text shown for unexpected error scenarios"
},
"unexpected-error-title": {
"defaultMessage": "Please try again or <link>raise a support request</link>",
"description": "Text shown for unexpected error scenarios"
"defaultMessage": "An unexpected error occurred",
"description": "Title of the notification shown for unexpected error scenarios"
},
"untitled-project": {
"defaultMessage": "Untitled project",
Expand Down
3 changes: 0 additions & 3 deletions lang/ui.es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,6 @@
"unexpected-error-description": {
"defaultMessage": "Inténtalo otra vez o <link>solicita asistencia</link>"
},
"unexpected-error-title": {
"defaultMessage": "Inténtalo otra vez o <link>solicita asistencia</link>"
},
"untitled-project": {
"defaultMessage": "Proyecto sin título"
},
Expand Down
3 changes: 0 additions & 3 deletions lang/ui.fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,6 @@
"unexpected-error-description": {
"defaultMessage": "Veuillez réessayer ou <link>soumettre une demande d’assistance</link>"
},
"unexpected-error-title": {
"defaultMessage": "Veuillez réessayer ou <link>soumettre une demande d’assistance</link>"
},
"untitled-project": {
"defaultMessage": "Projet sans titre"
},
Expand Down
3 changes: 0 additions & 3 deletions lang/ui.ga-IE.json
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,6 @@
"unexpected-error-description": {
"defaultMessage": "Bain triail eile as nó <link>ardaigh iarratas tacaíochta</link>"
},
"unexpected-error-title": {
"defaultMessage": "Bain triail eile as nó <link>ardaigh iarratas tacaíochta</link>"
},
"untitled-project": {
"defaultMessage": "Tionscadal gan teideal"
},
Expand Down
3 changes: 0 additions & 3 deletions lang/ui.ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,6 @@
"unexpected-error-description": {
"defaultMessage": "もう一度やり直すか、<link>サポートリクエストを提出</link>してください"
},
"unexpected-error-title": {
"defaultMessage": "もう一度やり直すか、<link>サポートリクエストを提出</link>してください"
},
"untitled-project": {
"defaultMessage": "無題プロジェクト"
},
Expand Down
3 changes: 0 additions & 3 deletions lang/ui.ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -833,9 +833,6 @@
"unexpected-error-description": {
"defaultMessage": "다시 시도하거나 <link>지원 요청을 접수하세요</link>"
},
"unexpected-error-title": {
"defaultMessage": "다시 시도하거나 <link>지원 요청을 접수하세요</link>"
},
"untitled-project": {
"defaultMessage": "이름 없는 프로젝트"
},
Expand Down
3 changes: 0 additions & 3 deletions lang/ui.lol.json
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,6 @@
"unexpected-error-description": {
"defaultMessage": "crwdns331774:0crwdne331774:0"
},
"unexpected-error-title": {
"defaultMessage": "crwdns331776:0crwdne331776:0"
},
"untitled-project": {
"defaultMessage": "crwdns331778:0crwdne331778:0"
},
Expand Down
3 changes: 0 additions & 3 deletions lang/ui.nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,6 @@
"unexpected-error-description": {
"defaultMessage": "Probeer het opnieuw of <link>doe een ondersteunings verzoek</link>"
},
"unexpected-error-title": {
"defaultMessage": "Probeer het opnieuw of <link>doe een ondersteunings verzoek</link>"
},
"untitled-project": {
"defaultMessage": "Naamloos Project"
},
Expand Down
3 changes: 0 additions & 3 deletions lang/ui.pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,6 @@
"unexpected-error-description": {
"defaultMessage": "Spróbuj ponownie lub <link>zgłoś prośbę o wsparcie</link>"
},
"unexpected-error-title": {
"defaultMessage": "Spróbuj ponownie lub <link>zgłoś prośbę o wsparcie</link>"
},
"untitled-project": {
"defaultMessage": "Projekt bez tytułu"
},
Expand Down
3 changes: 0 additions & 3 deletions lang/ui.pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,6 @@
"unexpected-error-description": {
"defaultMessage": "Por favor, tente novamente ou <link>abra um pedido de suporte</link>"
},
"unexpected-error-title": {
"defaultMessage": "Por favor, tente novamente ou <link>abra um pedido de suporte</link>"
},
"untitled-project": {
"defaultMessage": "Projeto sem título"
},
Expand Down
3 changes: 0 additions & 3 deletions lang/ui.zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -836,9 +836,6 @@
"unexpected-error-description": {
"defaultMessage": "请重试或 <link>raise a support request</link>"
},
"unexpected-error-title": {
"defaultMessage": "请重试或 <link>raise a support request</link>"
},
"untitled-project": {
"defaultMessage": "未命名的项目"
},
Expand Down
3 changes: 0 additions & 3 deletions lang/ui.zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -833,9 +833,6 @@
"unexpected-error-description": {
"defaultMessage": "請重試或<link>提出支援要求</link>"
},
"unexpected-error-title": {
"defaultMessage": "請重試或<link>提出支援要求</link>"
},
"untitled-project": {
"defaultMessage": "未命名的專案"
},
Expand Down
33 changes: 33 additions & 0 deletions src/common/use-action-feedback.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* (c) 2026, Micro:bit Educational Foundation and contributors
*
* SPDX-License-Identifier: MIT
*/
import { ToastFn } from "@microbit/ui";
import { createIntl } from "react-intl";
import { vi } from "vitest";
import { MockLogging } from "../logging/mock";
import messages from "../messages/ui.en.json";
import { ActionFeedback } from "./use-action-feedback";

describe("ActionFeedback", () => {
it("uses a distinct title for unexpected errors", () => {
const intl = createIntl({ locale: "en", messages });
const toast = Object.assign(vi.fn(), { closeAll: vi.fn() });
const logging = new MockLogging();
const feedback = new ActionFeedback(
toast as unknown as ToastFn,
logging,
intl
);

feedback.unexpectedError(new Error("Boom"));

expect(toast).toHaveBeenCalledOnce();
expect(toast.mock.calls[0][0]).toMatchObject({
title: "An unexpected error occurred",
status: "error",
});
expect(logging.errors).toHaveLength(1);
});
});
2 changes: 1 addition & 1 deletion src/common/use-action-feedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class ActionFeedback {
unexpectedError(error: any) {
this.logging.error("Unexpected error", error);
this.toast({
title: this.intl.formatMessage({ id: "unexpected-error-description" }),
title: this.intl.formatMessage({ id: "unexpected-error-title" }),
status: "error",
description: (
<>
Expand Down
Loading