mirror of
https://github.com/meienberger/runtipi.git
synced 2024-09-11 12:15:48 +03:00
feat: add some magic to errors
This commit is contained in:
parent
db570f6204
commit
4d962dc560
@ -1,33 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import React from 'react';
|
||||
|
||||
export default function TestErrorPage() {
|
||||
const fetchFaultyApi = async () => {
|
||||
const response = await fetch('/api/test-error');
|
||||
const json = await response.json();
|
||||
return json;
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="card d-flex">
|
||||
<Button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
throw new Error('Sentry Frontend Error');
|
||||
}}
|
||||
>
|
||||
Throw error
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
onClick={async () => {
|
||||
await fetchFaultyApi();
|
||||
}}
|
||||
>
|
||||
Fetch faulty API
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
"use client";
|
||||
|
||||
import { Button } from "@/components/ui/Button";
|
||||
import React from "react";
|
||||
|
||||
export function TestErrorPage() {
|
||||
const fetchFaultyApi = async () => {
|
||||
const response = await fetch("/api/test-error");
|
||||
const json = await response.json();
|
||||
return json;
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="card d-flex p-3">
|
||||
<h2>Congratulations! You found the secret Tipi Test Page 🎉</h2>
|
||||
<p className="card-subtitle">Now make it fail!</p>
|
||||
<Button
|
||||
className="mb-2"
|
||||
type="button"
|
||||
onClick={() => {
|
||||
throw new Error("Sentry Frontend Error");
|
||||
}}
|
||||
>
|
||||
Throw error
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
onClick={async () => {
|
||||
await fetchFaultyApi();
|
||||
}}
|
||||
>
|
||||
Fetch faulty API
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
@ -0,0 +1 @@
|
||||
export { TestErrorPage } from "./TestErrorPage";
|
12
src/app/(dashboard)/test-page/page.tsx
Normal file
12
src/app/(dashboard)/test-page/page.tsx
Normal file
@ -0,0 +1,12 @@
|
||||
import type { Metadata } from "next";
|
||||
import { TestErrorPage } from "./components/TestErrorPage";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
return {
|
||||
title: "Test Page - Tipi",
|
||||
};
|
||||
}
|
||||
|
||||
export default function TestPage() {
|
||||
return <TestErrorPage />;
|
||||
}
|
@ -224,6 +224,7 @@
|
||||
"HEADER_SOURCE_CODE": "Source code",
|
||||
"HEADER_SPONSOR": "Sponsor",
|
||||
"HEADER_UPDATE_AVAILABLE": "Update available",
|
||||
"HEADER_TEST_PAGE": "Test Page",
|
||||
"INTERNAL_SERVER_ERROR": "Internal server error",
|
||||
"LINKS_ADD_SUBMIT": "Submit",
|
||||
"LINKS_ADD_SUBTITLE": "Add external link to the dashboard",
|
||||
|
Loading…
Reference in New Issue
Block a user