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(), timestamp: new Date().toISOString(),
}); });
} catch (error) { } 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({ res.status(503).json({
status: "not_ready", status: "not_ready",
timestamp: new Date().toISOString(), 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 // Log error but don't fail the request
const reqLogger = logger.withRequestId(req.id); const reqLogger = logger.withRequestId(req.id);
reqLogger.error("Failed to send rental request email", { reqLogger.error("Failed to send rental request email", {
error: emailError, error: emailError.message,
stack: emailError.stack,
rentalId: rental.id, rentalId: rental.id,
ownerId: rentalWithDetails.ownerId, ownerId: rentalWithDetails.ownerId,
}); });
@@ -342,7 +343,8 @@ router.post("/", authenticateToken, requireVerifiedEmail, async (req, res) => {
// Log error but don't fail the request // Log error but don't fail the request
const reqLogger = logger.withRequestId(req.id); const reqLogger = logger.withRequestId(req.id);
reqLogger.error("Failed to send rental request confirmation email", { reqLogger.error("Failed to send rental request confirmation email", {
error: emailError, error: emailError.message,
stack: emailError.stack,
rentalId: rental.id, rentalId: rental.id,
renterId: rentalWithDetails.renterId, renterId: rentalWithDetails.renterId,
}); });
@@ -730,7 +732,8 @@ router.put("/:id/decline", authenticateToken, async (req, res) => {
// Log error but don't fail the request // Log error but don't fail the request
const reqLogger = logger.withRequestId(req.id); const reqLogger = logger.withRequestId(req.id);
reqLogger.error("Failed to send rental decline email", { reqLogger.error("Failed to send rental decline email", {
error: emailError, error: emailError.message,
stack: emailError.stack,
rentalId: rental.id, rentalId: rental.id,
renterId: updatedRental.renterId, renterId: updatedRental.renterId,
}); });

View File

@@ -32,7 +32,7 @@ class PayoutService {
return eligibleRentals; return eligibleRentals;
} catch (error) { } catch (error) {
console.error("Error getting eligible payouts:", error); logger.error("Error getting eligible payouts", { error: error.message, stack: error.stack });
throw error; throw error;
} }
} }
@@ -99,7 +99,7 @@ class PayoutService {
amount: rental.payoutAmount, amount: rental.payoutAmount,
}; };
} catch (error) { } 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 // Update status to failed
await rental.update({ await rental.update({
@@ -146,7 +146,7 @@ class PayoutService {
return results; return results;
} catch (error) { } 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; throw error;
} }
} }
@@ -209,7 +209,7 @@ class PayoutService {
return results; return results;
} catch (error) { } catch (error) {
console.error("Error retrying failed payouts:", error); logger.error("Error retrying failed payouts", { error: error.message, stack: error.stack });
throw error; throw error;
} }
} }

View File

@@ -101,7 +101,7 @@ class S3Service {
region: this.region, region: this.region,
}); });
} catch (error) { } 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); process.exit(1);
} }
} }

View File

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