Improve errors reporting
This commit is contained in:
		@@ -27,6 +27,7 @@ import { BaseLoginPage } from "./widgets/BaseLoginPage";
 | 
			
		||||
import { ViewNetworkRoute } from "./routes/ViewNetworkRoute";
 | 
			
		||||
import { VMXMLRoute } from "./routes/VMXMLRoute";
 | 
			
		||||
import { NetXMLRoute } from "./routes/NetXMLRoute";
 | 
			
		||||
import { HomeRoute } from "./routes/HomeRoute";
 | 
			
		||||
 | 
			
		||||
interface AuthContext {
 | 
			
		||||
  signedIn: boolean;
 | 
			
		||||
@@ -47,6 +48,8 @@ export function App() {
 | 
			
		||||
    createRoutesFromElements(
 | 
			
		||||
      signedIn || ServerApi.Config.auth_disabled ? (
 | 
			
		||||
        <Route path="*" element={<BaseAuthenticatedPage />}>
 | 
			
		||||
          <Route path="" element={<HomeRoute />} />
 | 
			
		||||
 | 
			
		||||
          <Route path="iso" element={<IsoFilesRoute />} />
 | 
			
		||||
 | 
			
		||||
          <Route path="vms" element={<VMListRoute />} />
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ interface APIResponse {
 | 
			
		||||
 | 
			
		||||
export class ApiError extends Error {
 | 
			
		||||
  constructor(message: string, public code: number, public data: any) {
 | 
			
		||||
    super(message);
 | 
			
		||||
    super(`HTTP status: ${code}\nMessage: ${message}\nData=${data}`);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -49,7 +49,10 @@ export function AlertDialogProvider(p: PropsWithChildren): React.ReactElement {
 | 
			
		||||
      >
 | 
			
		||||
        {title && <DialogTitle id="alert-dialog-title">{title}</DialogTitle>}
 | 
			
		||||
        <DialogContent>
 | 
			
		||||
          <DialogContentText id="alert-dialog-description">
 | 
			
		||||
          <DialogContentText
 | 
			
		||||
            id="alert-dialog-description"
 | 
			
		||||
            style={{ whiteSpace: "pre" }}
 | 
			
		||||
          >
 | 
			
		||||
            {message}
 | 
			
		||||
          </DialogContentText>
 | 
			
		||||
        </DialogContent>
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@ export function CreateNetworkRoute(): React.ReactElement {
 | 
			
		||||
      navigate(`/net/${res.uid}`);
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      console.error(e);
 | 
			
		||||
      alert("Failed to create network!");
 | 
			
		||||
      alert(`Failed to create network!\n${e}`);
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
@@ -59,7 +59,7 @@ export function EditNetworkRoute(): React.ReactElement {
 | 
			
		||||
      navigate(NetworkURL(network!));
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      console.error(e);
 | 
			
		||||
      alert("Failed to update network!");
 | 
			
		||||
      alert(`Failed to update network!\n${e}`);
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ export function CreateVMRoute(): React.ReactElement {
 | 
			
		||||
      navigate(v.ViewURL);
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      console.error(e);
 | 
			
		||||
      alert("Failed to create VM!");
 | 
			
		||||
      alert(`Failed to create VM!\n${e}`);
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								virtweb_frontend/src/routes/HomeRoute.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								virtweb_frontend/src/routes/HomeRoute.tsx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
import { VirtWebRouteContainer } from "../widgets/VirtWebRouteContainer";
 | 
			
		||||
 | 
			
		||||
export function HomeRoute(): React.ReactElement {
 | 
			
		||||
  return (
 | 
			
		||||
    <VirtWebRouteContainer label="VirtWeb">
 | 
			
		||||
      <p>VirtWeb is an Open Source web ui for Libvirt.</p>
 | 
			
		||||
      <p>
 | 
			
		||||
        You can use the menu on the left to access the different sections of the
 | 
			
		||||
        application.
 | 
			
		||||
      </p>
 | 
			
		||||
    </VirtWebRouteContainer>
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user