feat: refresh dashboards experience
This commit is contained in:
parent
1900f65e5e
commit
d7d6b748cc
9 changed files with 1626 additions and 281 deletions
|
|
@ -101,10 +101,24 @@ function isMissingProvisioningCodeColumn(error: unknown): boolean {
|
|||
return false
|
||||
}
|
||||
|
||||
function isMissingCompanyTable(error: unknown): boolean {
|
||||
if (error instanceof Prisma.PrismaClientKnownRequestError) {
|
||||
if (error.code === "P2021") return true
|
||||
const message = error.message.toLowerCase()
|
||||
if (message.includes("table") && message.includes("company") && message.includes("does not exist")) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
export async function safeCompanyFindMany(args: Prisma.CompanyFindManyArgs): Promise<Company[]> {
|
||||
try {
|
||||
return await prisma.company.findMany(args)
|
||||
} catch (error) {
|
||||
if (isMissingCompanyTable(error)) {
|
||||
return []
|
||||
}
|
||||
if (!isMissingProvisioningCodeColumn(error)) {
|
||||
throw error
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue