Skip to content

Commit 1997ad2

Browse files
authored
Merge pull request #4 from dminor/update-readme-and-workflow
Update readme and workflow
2 parents 60e3220 + af99bbe commit 1997ad2

File tree

4 files changed

+28
-46
lines changed

4 files changed

+28
-46
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@ on:
44
push:
55
branches:
66
- main
7+
permissions:
8+
contents: write
79

810
jobs:
911
deploy:
1012
runs-on: ubuntu-latest
1113

1214
steps:
13-
- uses: actions/checkout@v3
14-
- uses: ljharb/actions/node/install@main
15-
name: 'nvm install lts/* && npm install'
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
1617
with:
17-
node-version: lts/*
18-
- run: npm run build
19-
- uses: JamesIves/[email protected]
18+
node-version: 20
19+
- run: >
20+
npm ci --no-audit && npm run build
21+
- uses: JamesIves/[email protected]
2022
with:
2123
branch: gh-pages
22-
folder: build
24+
folder: dist
2325
clean: true

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
1-
# Error.captureStackTrace
1+
# Error.captureStackTrace
22

33
**Stage**: [Stage 1](https://tc39.es/process-document/)
44

5-
**Champion**: Matthew Gaudet (Mozilla)
5+
**Champions**: Matthew Gaudet (Mozilla), Daniel Minor (Mozilla)
66

77

8-
V8 has has a non-standard [Stack Trace API](https://v8.dev/docs/stack-trace-api) for a while.
8+
V8 has has a non-standard [Stack Trace API](https://v8.dev/docs/stack-trace-api) for a while.
99

10-
In August 2023, [JSC also shipped this method](https://github.com/WebKit/WebKit/commit/997e074bb35ed07b69c9b821141c91dd548e0d02)
10+
In August 2023, [JSC also shipped this method](https://github.com/WebKit/WebKit/commit/997e074bb35ed07b69c9b821141c91dd548e0d02)
1111

12-
This method [has now turned into a web-compatability problem](https://bugzilla.mozilla.org/show_bug.cgi?id=1886820), and as a result we should now standardize it.
12+
This method [has now turned into a web-compatability problem](https://bugzilla.mozilla.org/show_bug.cgi?id=1886820), and as a result we should now standardize it.
1313

1414
## `Error.captureStackTrace`
1515

1616
To quote the [V8 documentation](https://v8.dev/docs/stack-trace-api):
1717

1818
> Stack trace collection for custom exceptions
19-
>
19+
>
2020
> The stack trace mechanism used for built-in errors is implemented using a general stack trace collection API that is also available to user scripts. The function
21-
>
21+
>
2222
> Error.captureStackTrace(error, constructorOpt)
23-
>
23+
>
2424
> adds a stack property to the given error object that yields the stack trace at the time captureStackTrace was called. Stack traces collected through `Error.captureStackTrace` are immediately collected, formatted, and attached to the given error object.
25-
>
25+
>
2626
> The optional `constructorOpt` parameter allows you to pass in a function value. When collecting the stack trace all frames above the topmost call to this function, including that call, are left out of the stack trace. This can be useful to hide implementation details that won’t be useful to the user. The usual way of defining a custom error that captures a stack trace would be:
27-
>
27+
>
2828
> function MyError() {
2929
> Error.captureStackTrace(this, MyError);
3030
> // Any other initialization goes here.
3131
> }
32-
>
32+
>
3333
> Passing in `MyError` as a second argument means that the constructor call to `MyError` won’t show up in the stack trace.
3434
35-
## Implementation Divergence
35+
## Implementation Divergence
3636

37-
Unfortunately, the JSC implementation diverges from the V8 one:
37+
Unfortunately, the JSC implementation diverges from the V8 one:
3838

3939
- JSC attaches a string valued prop to the object provided, where V8 instead installs their stack-getter function.
4040
- It uses the JSC stack string format.
4141

42-
I would actually like to specify this like the JSC one. It's simpler. Similarly, the text for the contents of the stack string should probably be something along the lines of
42+
I would actually like to specify this like the JSC one. It's simpler. Similarly, the text for the contents of the stack string should probably be something along the lines of
4343

4444
> The contents of the stack string is a textual representation of the [execution context stack](https://tc39.es/ecma262/#execution-context-stack), however the actual format and contents are implemetation defined and should not be relied upon to be identical across implementations.
4545
4646

4747
## Related Work
4848

4949
- The [Error Stacks](https://github.com/tc39/proposal-error-stacks) proposal is largely an orthogonal one to this, but it would provide framework and text to talk about stack strings, as mostly the current spec doesn't really talk about stacks. However, for this proposal I'd argue we don't need to specify the contents of stack strings.
50-
- The [Error Stack Accessor](https://github.com/tc39/proposal-error-stack-accessor) proposal could be the other route by which the spec starts to talk about stacks.
50+
- The [Error Stack Accessor](https://github.com/tc39/proposal-error-stack-accessor) proposal could be the other route by which the spec starts to talk about stacks.
5151

5252
## History
53-
- Presented February 2025, and achieved Stage 1 [(slides)](https://docs.google.com/presentation/d/1SFdS9n5JR7Jqz29s7ApvkqDOqOfPW-IaBR2orK828As/mobilepresent?slide=id.p) (notes not yet posted)
53+
- Presented February 2025, and achieved Stage 1 [notes](https://github.com/tc39/notes/blob/main/meetings/2025-02/february-19.md#errorcapturestacktrace-for-stage-1)

package.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
{
22
"private": true,
3-
"name": "template-for-proposals",
4-
"description": "A repository template for ECMAScript proposals.",
3+
"name": "proposal-error-capturestacktrace",
4+
"description": "ECMAScript Proposal, specs, and reference implementation for Error.captureStackTrace",
55
"scripts": {
6-
"start": "npm run build-loose -- --watch",
7-
"build": "npm run build-loose -- --strict",
8-
"build-loose": "node -e 'fs.mkdirSync(\"build\", { recursive: true })' && ecmarkup --load-biblio @tc39/ecma262-biblio --verbose spec.emu build/index.html --lint-spec"
6+
"build": "ecmarkup --load-biblio @tc39/ecma262-biblio --verbose spec.emu --assets-dir dist dist/index.html --lint-spec"
97
},
108
"homepage": "https://github.com/tc39/template-for-proposals#readme",
119
"repository": {
@@ -16,8 +14,5 @@
1614
"devDependencies": {
1715
"@tc39/ecma262-biblio": "^2.1.2775",
1816
"ecmarkup": "^20.0.0"
19-
},
20-
"engines": {
21-
"node": ">= 12"
2217
}
2318
}

0 commit comments

Comments
 (0)