fix(scans): capture 403 when no permissions (#8280)

Co-authored-by: Pepe Fagoaga <pepe@prowler.com>
This commit is contained in:
Alejandro Bailo
2025-07-15 17:58:50 +02:00
committed by GitHub
parent 24a50c6ac2
commit 834a7d3b69
3 changed files with 9 additions and 12 deletions
+2
View File
@@ -19,6 +19,8 @@ All notable changes to the **Prowler UI** are documented in this file.
### 🐞 Fixed
- Error message when launching a scan if user has no permissions [(#8280)](https://github.com/prowler-cloud/prowler/pull/8280)
### Removed
---
+5 -8
View File
@@ -144,21 +144,18 @@ export const scanOnDemand = async (formData: FormData) => {
});
if (!response.ok) {
try {
const errorData = await response.json();
throw new Error(errorData?.message || "Failed to start scan");
} catch {
throw new Error("Failed to start scan");
}
const errorData = await response.json();
return { success: false, error: errorData.errors[0].detail };
}
const data = await response.json();
revalidatePath("/scans");
return parseStringify(data);
} catch (error) {
// eslint-disable-next-line no-console
console.error("Error starting scan:", error);
return { error: getErrorMessage(error) };
}
};
@@ -63,13 +63,11 @@ export const LaunchScanWorkflow = ({
const data = await scanOnDemand(formData);
if (data?.errors && data.errors.length > 0) {
const error = data.errors[0];
const errorMessage = `${error.detail}`;
if (data?.error) {
toast({
variant: "destructive",
title: "Oops! Something went wrong",
description: errorMessage,
description: data.error,
});
} else {
toast({