Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
409b7a6a
Unverified
Commit
409b7a6a
authored
Feb 24, 2026
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Feb 24, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for Next.js error telemetry for `AggregateError` (#90391)
parent
f74bdef4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
lib.rs
crates/next-error-code-swc-plugin/src/lib.rs
+11
-5
next_error_code_swc_plugin.wasm
packages/next/next_error_code_swc_plugin.wasm
+0
-0
No files found.
crates/next-error-code-swc-plugin/src/lib.rs
View file @
409b7a6a
...
@@ -75,7 +75,7 @@ fn is_error_class_name(name: &str) -> bool {
...
@@ -75,7 +75,7 @@ fn is_error_class_name(name: &str) -> bool {
||
name
==
"Warning"
||
name
==
"Warning"
}
}
// Get the string representation of the
first
argument of `new Error(...)`
// Get the string representation of the
message
argument of `new Error(...)`
fn
stringify_new_error_arg
(
expr
:
&
Expr
,
bindings
:
&
FxHashMap
<
Id
,
String
>
)
->
String
{
fn
stringify_new_error_arg
(
expr
:
&
Expr
,
bindings
:
&
FxHashMap
<
Id
,
String
>
)
->
String
{
match
expr
{
match
expr
{
Expr
::
Lit
(
lit
)
=>
match
lit
{
Expr
::
Lit
(
lit
)
=>
match
lit
{
...
@@ -136,10 +136,13 @@ impl VisitMut for TransformVisitor {
...
@@ -136,10 +136,13 @@ impl VisitMut for TransformVisitor {
Expr
::
New
(
new_expr
)
=>
match
&*
new_expr
.callee
{
Expr
::
New
(
new_expr
)
=>
match
&*
new_expr
.callee
{
Expr
::
Ident
(
ident
)
if
is_error_class_name
(
ident
.sym
.as_str
())
=>
{
Expr
::
Ident
(
ident
)
if
is_error_class_name
(
ident
.sym
.as_str
())
=>
{
if
let
Some
(
args
)
=
&
new_expr
.args
{
if
let
Some
(
args
)
=
&
new_expr
.args
{
if
let
Some
(
first_arg
)
=
args
.first
()
{
// AggregateError(errors, message) has the message as the second arg
let
message_arg_index
=
if
ident
.sym
.as_str
()
==
"AggregateError"
{
1
}
else
{
0
};
if
let
Some
(
message_arg
)
=
args
.get
(
message_arg_index
)
{
new_error_expr
=
Some
(
new_expr
.clone
());
new_error_expr
=
Some
(
new_expr
.clone
());
error_message
=
Some
(
stringify_new_error_arg
(
error_message
=
Some
(
stringify_new_error_arg
(
&
first
_arg
.expr
,
&
message
_arg
.expr
,
&
self
.resolved_bindings
,
&
self
.resolved_bindings
,
));
));
}
}
...
@@ -150,9 +153,12 @@ impl VisitMut for TransformVisitor {
...
@@ -150,9 +153,12 @@ impl VisitMut for TransformVisitor {
Expr
::
Call
(
call_expr
)
=>
match
&
call_expr
.callee
{
Expr
::
Call
(
call_expr
)
=>
match
&
call_expr
.callee
{
Callee
::
Expr
(
expr
)
=>
match
&**
expr
{
Callee
::
Expr
(
expr
)
=>
match
&**
expr
{
Expr
::
Ident
(
ident
)
if
is_error_class_name
(
ident
.sym
.as_str
())
=>
{
Expr
::
Ident
(
ident
)
if
is_error_class_name
(
ident
.sym
.as_str
())
=>
{
if
let
Some
(
first_arg
)
=
call_expr
.args
.first
()
{
// AggregateError(errors, message) has the message as the second arg
let
message_arg_index
=
if
ident
.sym
.as_str
()
==
"AggregateError"
{
1
}
else
{
0
};
if
let
Some
(
message_arg
)
=
call_expr
.args
.get
(
message_arg_index
)
{
error_message
=
Some
(
stringify_new_error_arg
(
error_message
=
Some
(
stringify_new_error_arg
(
&
first
_arg
.expr
,
&
message
_arg
.expr
,
&
self
.resolved_bindings
,
&
self
.resolved_bindings
,
));
));
...
...
packages/next/next_error_code_swc_plugin.wasm
View file @
409b7a6a
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment