diff --git a/package.json b/package.json index bb458d1..0c5ad2c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bmc-ui", - "version": "3.3.1", + "version": "3.3.2", "private": true, "type": "module", "scripts": { diff --git a/src/contexts/FlashContext.tsx b/src/contexts/FlashContext.tsx index 2e58bac..327fa5d 100644 --- a/src/contexts/FlashContext.tsx +++ b/src/contexts/FlashContext.tsx @@ -1,4 +1,4 @@ -import { type AxiosProgressEvent } from "axios"; +import { type AxiosError, type AxiosProgressEvent } from "axios"; import { filesize } from "filesize"; import React, { createContext, @@ -125,11 +125,13 @@ export const FlashProvider: React.FC = ({ children }) => { }, onError: (error) => { setIsUploading(false); - const msg = t("firmwareUpgrade.uploadFailed"); - setStatusMessage(msg); + const title = t("firmwareUpgrade.uploadFailed"); + const errorMessage = + ((error as AxiosError).response?.data as string) ?? error.message; + setStatusMessage(`${title}: ${errorMessage}`); toast({ - title: msg, - description: error.message, + title, + description: errorMessage, variant: "destructive", }); }, @@ -159,11 +161,13 @@ export const FlashProvider: React.FC = ({ children }) => { }, onError: (error) => { setIsUploading(false); - const msg = t("flashNode.transferFailed", { nodeId }); - setStatusMessage(msg); + const title = t("flashNode.transferFailed", { nodeId }); + const errorMessage = + ((error as AxiosError).response?.data as string) ?? error.message; + setStatusMessage(`${title}: ${errorMessage}`); toast({ - title: msg, - description: error.message, + title, + description: errorMessage, variant: "destructive", }); },