Created
January 13, 2021 00:16
-
-
Save cakoose/5271c469142205d37c600000cc22bb3e to your computer and use it in GitHub Desktop.
Issue with stack traces in NPM library @ff00ff/mammoth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {defineTable, defineDb, text} from '@ff00ff/mammoth'; | |
const foo = defineTable({ | |
id: text(), | |
}); | |
const db = defineDb({foo}, async (query, parameters) => { | |
// To force an async gap. | |
await new Promise(setImmediate); | |
throw new Error('blah'); | |
}); | |
async function mainAsync(): Promise<void> { | |
await db.select(db.foo.id).from(db.foo); | |
} | |
if (require.main === module) { | |
mainAsync().catch(err => { | |
console.error(err); | |
process.exit(1); | |
}); | |
} | |
/* | |
$ ./node_modules/.bin/ts-node main.ts | |
Error: blah | |
at SelectQuery.queryExecutor (/Users/kannan/Anrok/mammoth-test/main.ts:11:11) | |
The exception stack trace is truncated. It doesn't contain 'mainAsync'. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "mammoth-async-stack-trace", | |
"version": "1.0.0", | |
"license": "CC0", | |
"private": true, | |
"devDependencies": { | |
"@types/node": "^14.14.20", | |
"ts-node": "^9.1.1", | |
"typescript": "^4.1.3" | |
}, | |
"dependencies": { | |
"@ff00ff/mammoth": "^1.2.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment