Debug: Instrumentierung für isBigNumber-Fehler (Console-Log + Fetch)
This commit is contained in:
@@ -37,15 +37,31 @@ export type ContactFormData = {
|
|||||||
|
|
||||||
export async function createContactDocument(data: ContactFormData) {
|
export async function createContactDocument(data: ContactFormData) {
|
||||||
if (!_databases) _databases = getDatabases();
|
if (!_databases) _databases = getDatabases();
|
||||||
return _databases.createDocument<ContactFormData>(
|
const docId = ID.unique();
|
||||||
CONTACT_DATABASE_ID,
|
// #region agent log
|
||||||
CONTACT_COLLECTION_ID,
|
fetch('http://localhost:7243/ingest/8d1383cf-9102-464e-a10c-b6b8ee60ecff',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'appwrite.ts:createContactDocument',message:'before createDocument',data:{docId},timestamp:Date.now(),hypothesisId:'C'})}).catch(()=>{});
|
||||||
ID.unique(),
|
// #endregion
|
||||||
{
|
try {
|
||||||
name: data.name,
|
const result = await _databases.createDocument<ContactFormData>(
|
||||||
email: data.email,
|
CONTACT_DATABASE_ID,
|
||||||
company: data.company,
|
CONTACT_COLLECTION_ID,
|
||||||
message: data.message,
|
docId,
|
||||||
}
|
{
|
||||||
);
|
name: data.name,
|
||||||
|
email: data.email,
|
||||||
|
company: data.company,
|
||||||
|
message: data.message,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
// #region agent log
|
||||||
|
fetch('http://localhost:7243/ingest/8d1383cf-9102-464e-a10c-b6b8ee60ecff',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'appwrite.ts:createContactDocument',message:'createDocument resolved',data:{}},timestamp:Date.now(),hypothesisId:'A'})}).catch(()=>{});
|
||||||
|
// #endregion
|
||||||
|
return result;
|
||||||
|
} catch (e) {
|
||||||
|
// #region agent log
|
||||||
|
const errObj = e instanceof Error ? { message: e.message, stack: e.stack, name: e.name } : { message: String(e) };
|
||||||
|
fetch('http://localhost:7243/ingest/8d1383cf-9102-464e-a10c-b6b8ee60ecff',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'appwrite.ts:createContactDocument catch',message:'createDocument rejected',data:errObj,timestamp:Date.now(),hypothesisId:'A,B,C,D,E'})}).catch(()=>{});
|
||||||
|
// #endregion
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,15 +30,25 @@ const Contact = () => {
|
|||||||
const handleSubmit = async (e: React.FormEvent) => {
|
const handleSubmit = async (e: React.FormEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setIsSubmitting(true);
|
setIsSubmitting(true);
|
||||||
|
// #region agent log
|
||||||
|
fetch('http://localhost:7243/ingest/8d1383cf-9102-464e-a10c-b6b8ee60ecff',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'Contact.tsx:handleSubmit',message:'submit started',data:{hasFormData:!!formData},timestamp:Date.now(),hypothesisId:'E'})}).catch(()=>{});
|
||||||
|
// #endregion
|
||||||
try {
|
try {
|
||||||
await createContactDocument(formData);
|
await createContactDocument(formData);
|
||||||
|
// #region agent log
|
||||||
|
fetch('http://localhost:7243/ingest/8d1383cf-9102-464e-a10c-b6b8ee60ecff',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'Contact.tsx:handleSubmit',message:'createContactDocument resolved',data:{},timestamp:Date.now(),hypothesisId:'A'})}).catch(()=>{});
|
||||||
|
// #endregion
|
||||||
toast({
|
toast({
|
||||||
title: "Nachricht gesendet!",
|
title: "Nachricht gesendet!",
|
||||||
description: "Wir melden uns innerhalb von 24 Stunden bei Ihnen.",
|
description: "Wir melden uns innerhalb von 24 Stunden bei Ihnen.",
|
||||||
});
|
});
|
||||||
setFormData({ name: "", email: "", company: "", message: "" });
|
setFormData({ name: "", email: "", company: "", message: "" });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
// #region agent log
|
||||||
|
const errObj = err instanceof Error ? { message: err.message, stack: err.stack, name: err.name } : { message: String(err) };
|
||||||
|
fetch('http://localhost:7243/ingest/8d1383cf-9102-464e-a10c-b6b8ee60ecff',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({location:'Contact.tsx:handleSubmit catch',message:'createContactDocument rejected',data:errObj,timestamp:Date.now(),hypothesisId:'A,B,C,D,E'})}).catch(()=>{});
|
||||||
|
if (typeof console !== 'undefined' && err instanceof Error) console.error('[Contact] createContactDocument failed', err.message, err.stack);
|
||||||
|
// #endregion
|
||||||
const message = err instanceof Error ? err.message : "Speichern fehlgeschlagen.";
|
const message = err instanceof Error ? err.message : "Speichern fehlgeschlagen.";
|
||||||
toast({
|
toast({
|
||||||
variant: "destructive",
|
variant: "destructive",
|
||||||
|
|||||||
Reference in New Issue
Block a user