Skip to content

Commit

Permalink
Merge pull request #147 from CriticalMoments/log_errors
Browse files Browse the repository at this point in the history
Fixes #145
  • Loading branch information
scosman authored Sep 9, 2024
2 parents 6b60de6 + 25dc44c commit 7a8ac18
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/routes/(admin)/account/(menu)/billing/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const load: PageServerLoad = async ({
user,
})
if (idError || !customerId) {
console.error("Error creating customer id", idError)
error(500, {
message: "Unknown error. If issue persists, please contact us.",
})
Expand All @@ -31,6 +32,7 @@ export const load: PageServerLoad = async ({
customerId,
})
if (fetchErr) {
console.error("Error fetching subscription", fetchErr)
error(500, {
message: "Unknown error. If issue persists, please contact us.",
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const load: PageServerLoad = async ({
user,
})
if (idError || !customerId) {
console.error("Error creating customer id", idError)
error(500, {
message: "Unknown error (PCID). If issue persists, please contact us.",
})
Expand All @@ -32,6 +33,7 @@ export const load: PageServerLoad = async ({
})
portalLink = portalSession?.url
} catch (e) {
console.error("Error creating billing portal session", e)
error(500, "Unknown error (PSE). If issue persists, please contact us.")
}

Expand Down
1 change: 1 addition & 0 deletions src/routes/(admin)/account/+layout.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const load: LayoutServerLoad = async ({
cookies,
}) => {
// Session here is from authGuard hook

return {
session,
cookies: cookies.getAll(),
Expand Down
5 changes: 5 additions & 0 deletions src/routes/(admin)/account/api/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const actions = {
.eq("id", session.user.id)

if (error) {
console.error("Error updating subscription status", error)
return fail(500, { message: "Failed to update subscription status" })
}

Expand Down Expand Up @@ -62,6 +63,7 @@ export const actions = {
const { error } = await supabase.auth.updateUser({ email: email })

if (error) {
console.error("Error updating email", error)
return fail(500, {
errorMessage: "Unknown error. If this persists please contact us.",
email,
Expand Down Expand Up @@ -160,6 +162,7 @@ export const actions = {
password: newPassword1,
})
if (error) {
console.error("Error updating password", error)
return fail(500, {
errorMessage: "Unknown error. If this persists please contact us.",
newPassword1,
Expand Down Expand Up @@ -210,6 +213,7 @@ export const actions = {
true,
)
if (error) {
console.error("Error deleting user", error)
return fail(500, {
errorMessage: "Unknown error. If this persists please contact us.",
currentPassword,
Expand Down Expand Up @@ -286,6 +290,7 @@ export const actions = {
.select()

if (error) {
console.error("Error updating profile", error)
return fail(500, {
errorMessage: "Unknown error. If this persists please contact us.",
fullName,
Expand Down
2 changes: 2 additions & 0 deletions src/routes/(admin)/account/subscribe/[slug]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const load: PageServerLoad = async ({
user,
})
if (idError || !customerId) {
console.error("Error creating customer id", idError)
error(500, {
message: "Unknown error. If issue persists, please contact us.",
})
Expand Down Expand Up @@ -57,6 +58,7 @@ export const load: PageServerLoad = async ({
})
checkoutUrl = stripeSession.url
} catch (e) {
console.error("Error creating checkout session", e)
error(500, "Unknown Error (SSE): If issue persists please contact us.")
}

Expand Down
2 changes: 1 addition & 1 deletion src/routes/(marketing)/contact_us/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const actions = {
errors["message"] = "Message too long (" + message.length + " of 2000)"
}

console.log("errors:", errors)
if (Object.keys(errors).length > 0) {
return fail(400, { errors })
}
Expand All @@ -66,6 +65,7 @@ export const actions = {
})

if (insertError) {
console.error("Error saving contact request", insertError)
return fail(500, { errors: { _: "Error saving" } })
}

Expand Down

0 comments on commit 7a8ac18

Please sign in to comment.