Skip to content

Instantly share code, notes, and snippets.

@cakoose
Created January 13, 2021 00:16
Show Gist options
  • Save cakoose/5271c469142205d37c600000cc22bb3e to your computer and use it in GitHub Desktop.
Save cakoose/5271c469142205d37c600000cc22bb3e to your computer and use it in GitHub Desktop.
Issue with stack traces in NPM library @ff00ff/mammoth
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'.
*/
{
"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