Skip to content

Commit

Permalink
chore: test more unhappy paths
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed Jul 3, 2020
1 parent d32cc23 commit abf789f
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,22 @@ Invalid \`prisma.user.findMany()\` invocation in
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\\"no such column: dev.User.name\\"))) })"
`;

exports[`runtime missing-relation: missing-relation example should not succeed 1`] = `
"
Invalid \`prisma.post.findMany()\` invocation in
PANIC: Application logic invariant error: received null value for field author which may not be null
This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic.
https:
If you want the Prisma team to look into it, please open the link above 🙏
"
`;

exports[`runtime missing-table: missing-table example should not succeed 1`] = `
"
Invalid \`prisma.user.findMany()\` invocation in
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!dev.db
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { PrismaClient } = require('@prisma/client')

module.exports = async () => {
const prisma = new PrismaClient()
try {
const post = await prisma.post.findMany({
include: {
author: true,
},
})
console.log(post)
} catch (e) {
prisma.disconnect()
throw e
}
}

if (require.main === module) {
module.exports()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"shouldSucceed": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
datasource db {
provider = "sqlite"
url = "file:dev.db"
default = true
}

generator client {
provider = "prisma-client-js"
}

// / User model comment
model User {
id String @default(uuid()) @id
email String @unique
// / name comment
name String?
posts Post[]
}

model Post {
id String @default(cuid()) @id
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
published Boolean
title String
content String?
authorId String
author User @relation(fields: [authorId], references: [id])
}
1 change: 1 addition & 0 deletions src/packages/client/src/runtime/getPrismaClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ export class PrismaClientFetcher {
}
return unpackResult
} catch (e) {
debug(e)
let message = e.message
if (callsite) {
const { stack } = printStack({
Expand Down
3 changes: 2 additions & 1 deletion src/packages/engine-core/src/NodeEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,8 @@ ${this.lastErrorLog.fields.file}:${this.lastErrorLog.fields.line}:${this.lastErr
} else if (
(error.code && error.code === 'ECONNRESET') ||
error.code === 'ECONNREFUSED' ||
error.message.toLowerCase().includes('client is destroyed')
error.message.toLowerCase().includes('client is destroyed') ||
error.message.toLowerCase().includes('other side closed')
) {
if (this.globalKillSignalReceived && !this.child.connected) {
throw new PrismaClientUnknownRequestError(`The Node.js process already received a ${this.globalKillSignalReceived} signal, therefore the Prisma query engine exited
Expand Down

0 comments on commit abf789f

Please sign in to comment.