more stack traces

This commit is contained in:
jackiettran
2025-12-25 19:05:12 -05:00
parent 76e4039ba8
commit 4f85243815
5 changed files with 23 additions and 19 deletions

View File

@@ -109,7 +109,7 @@ router.get("/ready", async (req, res) => {
timestamp: new Date().toISOString(),
});
} catch (error) {
logger.error("Readiness check failed", { error: error.message });
logger.error("Readiness check failed", { error: error.message, stack: error.stack });
res.status(503).json({
status: "not_ready",
timestamp: new Date().toISOString(),

View File

@@ -321,7 +321,8 @@ router.post("/", authenticateToken, requireVerifiedEmail, async (req, res) => {
// Log error but don't fail the request
const reqLogger = logger.withRequestId(req.id);
reqLogger.error("Failed to send rental request email", {
error: emailError,
error: emailError.message,
stack: emailError.stack,
rentalId: rental.id,
ownerId: rentalWithDetails.ownerId,
});
@@ -342,7 +343,8 @@ router.post("/", authenticateToken, requireVerifiedEmail, async (req, res) => {
// Log error but don't fail the request
const reqLogger = logger.withRequestId(req.id);
reqLogger.error("Failed to send rental request confirmation email", {
error: emailError,
error: emailError.message,
stack: emailError.stack,
rentalId: rental.id,
renterId: rentalWithDetails.renterId,
});
@@ -730,7 +732,8 @@ router.put("/:id/decline", authenticateToken, async (req, res) => {
// Log error but don't fail the request
const reqLogger = logger.withRequestId(req.id);
reqLogger.error("Failed to send rental decline email", {
error: emailError,
error: emailError.message,
stack: emailError.stack,
rentalId: rental.id,
renterId: updatedRental.renterId,
});

View File

@@ -32,7 +32,7 @@ class PayoutService {
return eligibleRentals;
} catch (error) {
console.error("Error getting eligible payouts:", error);
logger.error("Error getting eligible payouts", { error: error.message, stack: error.stack });
throw error;
}
}
@@ -99,7 +99,7 @@ class PayoutService {
amount: rental.payoutAmount,
};
} catch (error) {
console.error(`Error processing payout for rental ${rental.id}:`, error);
logger.error("Error processing payout for rental", { error: error.message, stack: error.stack, rentalId: rental.id });
// Update status to failed
await rental.update({
@@ -146,7 +146,7 @@ class PayoutService {
return results;
} catch (error) {
console.error("Error processing all eligible payouts:", error);
logger.error("Error processing all eligible payouts", { error: error.message, stack: error.stack });
throw error;
}
}
@@ -209,7 +209,7 @@ class PayoutService {
return results;
} catch (error) {
console.error("Error retrying failed payouts:", error);
logger.error("Error retrying failed payouts", { error: error.message, stack: error.stack });
throw error;
}
}

View File

@@ -101,7 +101,7 @@ class S3Service {
region: this.region,
});
} catch (error) {
logger.error("Failed to initialize S3 Service", { error: error.message });
logger.error("Failed to initialize S3 Service", { error: error.message, stack: error.stack });
process.exit(1);
}
}

View File

@@ -1,4 +1,5 @@
const stripe = require("stripe")(process.env.STRIPE_SECRET_KEY);
const logger = require("../utils/logger");
class StripeService {
@@ -8,7 +9,7 @@ class StripeService {
expand: ['setup_intent', 'setup_intent.payment_method']
});
} catch (error) {
console.error("Error retrieving checkout session:", error);
logger.error("Error retrieving checkout session", { error: error.message, stack: error.stack });
throw error;
}
}
@@ -26,7 +27,7 @@ class StripeService {
return account;
} catch (error) {
console.error("Error creating connected account:", error);
logger.error("Error creating connected account", { error: error.message, stack: error.stack });
throw error;
}
}
@@ -42,7 +43,7 @@ class StripeService {
return accountLink;
} catch (error) {
console.error("Error creating account link:", error);
logger.error("Error creating account link", { error: error.message, stack: error.stack });
throw error;
}
}
@@ -58,7 +59,7 @@ class StripeService {
requirements: account.requirements,
};
} catch (error) {
console.error("Error retrieving account status:", error);
logger.error("Error retrieving account status", { error: error.message, stack: error.stack });
throw error;
}
}
@@ -79,7 +80,7 @@ class StripeService {
return transfer;
} catch (error) {
console.error("Error creating transfer:", error);
logger.error("Error creating transfer", { error: error.message, stack: error.stack });
throw error;
}
}
@@ -100,7 +101,7 @@ class StripeService {
return refund;
} catch (error) {
console.error("Error creating refund:", error);
logger.error("Error creating refund", { error: error.message, stack: error.stack });
throw error;
}
}
@@ -109,7 +110,7 @@ class StripeService {
try {
return await stripe.refunds.retrieve(refundId);
} catch (error) {
console.error("Error retrieving refund:", error);
logger.error("Error retrieving refund", { error: error.message, stack: error.stack });
throw error;
}
}
@@ -167,7 +168,7 @@ class StripeService {
amountCharged: amount, // Original amount in dollars
};
} catch (error) {
console.error("Error charging payment method:", error);
logger.error("Error charging payment method", { error: error.message, stack: error.stack });
throw error;
}
}
@@ -182,7 +183,7 @@ class StripeService {
return customer;
} catch (error) {
console.error("Error creating customer:", error);
logger.error("Error creating customer", { error: error.message, stack: error.stack });
throw error;
}
}
@@ -204,7 +205,7 @@ class StripeService {
return session;
} catch (error) {
console.error("Error creating setup checkout session:", error);
logger.error("Error creating setup checkout session", { error: error.message, stack: error.stack });
throw error;
}
}