mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 04:51:51 +00:00
fix(scans): capture 403 when no permissions (#8280)
Co-authored-by: Pepe Fagoaga <pepe@prowler.com>
This commit is contained in:
@@ -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
|
||||
|
||||
---
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user