Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/db-d1-sqlite/src/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const connect: Connect = async function connect(
this.rejectInitializing()
}
console.error(err)
process.exit(1)
throw new Error(`Error: cannot connect to SQLite: ${message}`)
}

// Only push schema if not in production
Expand Down
2 changes: 1 addition & 1 deletion packages/db-mongodb/src/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,6 @@ export const connect: Connect = async function connect(
err,
msg,
})
process.exit(1)
throw new Error(`Error: cannot connect to MongoDB: ${msg}`)
}
}
2 changes: 1 addition & 1 deletion packages/db-postgres/src/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const connect: Connect = async function connect(
if (typeof this.rejectInitializing === 'function') {
this.rejectInitializing()
}
process.exit(1)
throw new Error(`Error: cannot connect to Postgres: ${err.message}`)
}

await this.createExtensions()
Expand Down
2 changes: 1 addition & 1 deletion packages/db-sqlite/src/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const connect: Connect = async function connect(
if (typeof this.rejectInitializing === 'function') {
this.rejectInitializing()
}
process.exit(1)
throw new Error(`Error: cannot connect to SQLite: ${message}`)
}

// Only push schema if not in production
Expand Down
2 changes: 1 addition & 1 deletion packages/db-vercel-postgres/src/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const connect: Connect = async function connect(
if (typeof this.rejectInitializing === 'function') {
this.rejectInitializing()
}
process.exit(1)
throw new Error(`Error: cannot connect to Postgres: ${err.message}`)
}

await this.createExtensions()
Expand Down
2 changes: 1 addition & 1 deletion packages/drizzle/src/transactions/beginTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const beginTransaction: BeginTransaction = async function beginTransactio
}
} catch (err) {
this.payload.logger.error({ err, msg: `Error: cannot begin transaction: ${err.message}` })
process.exit(1)
throw new Error(`Error: cannot begin transaction: ${err.message}`)
}

return id
Expand Down
10 changes: 5 additions & 5 deletions packages/payload/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1127,12 +1127,12 @@ export const getPayload = async (
return cached.payload
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awaiting the promise is already wrapped in try{} catch {}. Feels weird not to wrap this floating promise execution in the same try {} catch {}

}

if (!cached.promise) {
// no need to await options.config here, as it's already awaited in the BasePayload.init
cached.promise = new BasePayload().init(options)
}

try {
if (!cached.promise) {
// no need to await options.config here, as it's already awaited in the BasePayload.init
cached.promise = new BasePayload().init(options)
}

cached.payload = await cached.promise

if (
Expand Down
Loading