Skip to content

Commit 545f72c

Browse files
committed
[IMP] image: do not swallow exception
If the image upload fails, it means there's a problem somewhere that needs to be investiguated. But we are currently try/catching the error to show a user-friendly message. Several issues: - The user doesn't care if the message is friendly or not: he wanted to upload an image and it doesn't work. - the person investiguating the issue wants the full traceback to investiguate efficiently Task: 5176795 Part-of: #7353 Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
1 parent 90a817d commit 545f72c

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

src/actions/menu_items_actions.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
ClipboardMIMEType,
1515
ClipboardPasteOptions,
1616
} from "@odoo/o-spreadsheet-engine/types/clipboard";
17-
import { Image } from "@odoo/o-spreadsheet-engine/types/image";
1817
import { SpreadsheetChildEnv } from "@odoo/o-spreadsheet-engine/types/spreadsheet_env";
1918
import { getPivotTooBigErrorMessage } from "../../packages/o-spreadsheet-engine/src/components/translations_terms";
2019
import { CellPopoverStore } from "../components/popover";
@@ -520,23 +519,12 @@ export const REINSERT_STATIC_PIVOT_CHILDREN = (env: SpreadsheetChildEnv) =>
520519
//------------------------------------------------------------------------------
521520
// Image
522521
//------------------------------------------------------------------------------
523-
async function requestImage(env: SpreadsheetChildEnv): Promise<Image | undefined> {
524-
try {
525-
return await env.imageProvider!.requestImage();
526-
} catch {
527-
env.raiseError(_t("An unexpected error occurred during the image transfer"));
528-
return;
529-
}
530-
}
531522

532523
export const CREATE_IMAGE = async (env: SpreadsheetChildEnv) => {
533524
if (env.imageProvider) {
534525
const sheetId = env.model.getters.getActiveSheetId();
535526
const figureId = env.model.uuidGenerator.smallUuid();
536-
const image = await requestImage(env);
537-
if (!image) {
538-
return;
539-
}
527+
const image = await env.imageProvider.requestImage();
540528
const size = getMaxFigureSize(env.model.getters, image.size);
541529
const { col, row, offset } = centerFigurePosition(env.model.getters, size);
542530
env.model.dispatch("CREATE_IMAGE", {

0 commit comments

Comments
 (0)