-
-
Save lorefnon/38082a052af564ce00f3163db98fc8d3 to your computer and use it in GitHub Desktop.
overridable-fn-error-stack-demo
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
❯ npx tsx ./index.ts | |
Hello Gentoo1337 | |
/home/lorefnon/ofn-test/override.ts:5 | |
throw new Error("Testing stack"); | |
^ | |
Error: Testing stack | |
at <anonymous> (/home/lorefnon/ofn-test/override.ts:5:11) | |
at invoker (/home/lorefnon/ofn-test/node_modules/.pnpm/overridable-fn@2.1.1/node_modules/overridable-fn/src/index.ts:37:16) | |
at <anonymous> (/home/lorefnon/ofn-test/index.ts:4:1) | |
at Object.<anonymous> (/home/lorefnon/ofn-test/index.ts:4:7) | |
at Module._compile (node:internal/modules/cjs/loader:1255:14) | |
at Object.S (/home/lorefnon/ofn-test/node_modules/.pnpm/tsx@4.7.1/node_modules/tsx/dist/cjs/index.cjs:1:1292) | |
at Module.load (node:internal/modules/cjs/loader:1113:32) | |
at Module._load (node:internal/modules/cjs/loader:960:12) | |
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:165:29) | |
at ModuleJob.run (node:internal/modules/esm/module_job:192:25) | |
Node.js v20.2.0 |
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 { fn } from "overridable-fn"; | |
export const hello = fn(() => { | |
console.log(`Hello Lorefnon`) | |
}); |
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 { hello } from "./fn" | |
import "./override" | |
hello(); |
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 {hello} from "./fn" | |
hello.override(() => () => { | |
console.log("Hello Gentoo1337"); | |
throw new Error("Testing stack"); | |
}); |
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": "ofn-test", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"overridable-fn": "^2.1.1", | |
"tsx": "^4.7.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment