Skip to content

Commit

Permalink
fix(migrate,introspection): remove failed- .md logic (#7059)
Browse files Browse the repository at this point in the history
Closes #4715
  • Loading branch information
Jolg42 committed May 17, 2021
1 parent 1594140 commit 06236eb
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 56 deletions.
1 change: 0 additions & 1 deletion src/packages/client/.gitignore
Expand Up @@ -15,7 +15,6 @@ src/utils/transformed-dmmf.json
*-dmmf.json
*-dmmf-raw.json
db
failed-*.md
query-engine*
test.sh
try-getConfig.ts
Expand Down
1 change: 0 additions & 1 deletion src/packages/migrate/.gitignore
Expand Up @@ -5,7 +5,6 @@ dist
build
.DS_Store
tmp/
failed-*.md
.env*
pnpm-debug.log
write-test
Expand Down
29 changes: 1 addition & 28 deletions src/packages/migrate/src/MigrateEngine.ts
Expand Up @@ -337,7 +337,6 @@ export class MigrateEngine {
reject(new Error(message))
}
} else {
const text = this.persistError(request, this.messages.join('\n'))
reject(
new Error(
`${chalk.redBright(
Expand All @@ -348,7 +347,7 @@ export class MigrateEngine {
2,
)}\nResponse: ${JSON.stringify(response, null, 2)}\n${
response.error.message
}\n\n${text}\n`,
}\n`,
),
)
}
Expand All @@ -375,33 +374,7 @@ export class MigrateEngine {
this.lastRequest = request
})
}
private persistError(request: any, message: string): string {
const filename = `failed-${request.method}-${now()}.md`
fs.writeFileSync(
filename,
`# Failed ${request.method} at ${new Date().toISOString()}
## RPC One-Liner
\`\`\`json
${JSON.stringify(request)}
\`\`\`

## RPC Input Readable
\`\`\`json
${JSON.stringify(request, null, 2)}
\`\`\`
## Stack Trace
\`\`\`bash
${message}
\`\`\`
`,
)
return `Wrote ${chalk.bold(filename)} with debugging information.
Please put that file into a gist and post it in Slack.
1. ${chalk.greenBright(`cat ${filename} | pbcopy`)}
2. Create a gist ${chalk.greenBright.underline(`https://gist.github.com/new`)}`
// }
}
private getRPCPayload(method: string, params: any): RPCPayload {
return {
id: messageId++,
Expand Down
1 change: 0 additions & 1 deletion src/packages/sdk/.gitignore
Expand Up @@ -9,7 +9,6 @@ prisma-fmt*
libquery*
write-test
sandbox
failed-*
/debug.d.ts
/debug.js
/debug.js.map
Expand Down
26 changes: 1 addition & 25 deletions src/packages/sdk/src/IntrospectionEngine.ts
Expand Up @@ -428,7 +428,6 @@ export class IntrospectionEngine {
reject(new Error(message))
}
} else {
const text = this.persistError(request, this.messages.join('\n'))
reject(
new Error(
`${chalk.redBright(
Expand All @@ -439,7 +438,7 @@ export class IntrospectionEngine {
2,
)}\nResponse: ${JSON.stringify(response, null, 2)}\n${
response.error.message
}\n\n${text}\n`,
}\n`,
),
)
}
Expand All @@ -466,30 +465,7 @@ export class IntrospectionEngine {
this.lastRequest = request
})
}
private persistError(request: any, message: string): string {
const filename = `failed-${request.method}-${now()}.md`
const file = `# Failed ${request.method} at ${new Date().toISOString()}
## RPC One-Liner
\`\`\`json
${JSON.stringify(request)}
\`\`\`

## RPC Input Readable
\`\`\`json
${JSON.stringify(request, null, 2)}
\`\`\`
## Stack Trace
\`\`\`bash
${message}
\`\`\`
`
fs.writeFileSync(filename, file)
return `Wrote ${chalk.bold(filename)} with debugging information.
Please put that file into a gist and post it in Slack.
1. ${chalk.greenBright(`cat ${filename} | pbcopy`)}
2. Create a gist ${chalk.greenBright.underline(`https://gist.github.com/new`)}`
}
private getRPCPayload(method: string, params: any): RPCPayload {
return {
id: messageId++,
Expand Down

0 comments on commit 06236eb

Please sign in to comment.