v12.0.1 error: not implemented: regenerator: complex pattern in catch clause
See original GitHub issueWhat version of Next.js are you using?
12.0.1
What version of Node.js are you using?
14.15.0
What browser are you using?
chrome
What operating system are you using?
mac
How are you deploying your application?
NODE_OPTIONS=‘–inspect’ next dev
Describe the Bug
I got this error thread '<unnamed>' panicked at 'not implemented: regenerator: complex pattern in catch clause', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_transforms_compat-0.47.1/src/es2015/regenerator/case.rs:1232:30
after upgrade from v11 to v12
Expected Behavior
it should work fine like v11 !
To Reproduce
try { // my code } catch ({ error }: any) { // handling error }
after I remove the try-catch statement everything works fine !
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:16 (7 by maintainers)
Top Results From Across the Web
Error: failed to process not implemented: regenerator: complex ...
beacuse we use {} in catch block and swc cant figure out what is destructuring ! const handleSubmit = useMutation(async () => {...
Read more >Error: failed to process not implemented: regenerator: complex ...
Coding example for the question Error: failed to process not implemented: regenerator: complex pattern in catch clause -- In NextJs 12-Reactjs.
Read more >Different ways to catch throwing errors from Swift do-catch
Catch a particular type of error. Catch all clause handle any error thrown from the do clause the same way. It is easy,...
Read more >Full Software Preparation PDF | PDF | Pointer (Computer ... - Scribd
Compiler error: Cannot modify a constant value. Explanation: p is a pointer to a "constant integer". But we tried to change the value...
Read more >Error handling, "try...catch" - The Modern JavaScript Tutorial
First, the code in try {...} is executed. If there were no errors, then catch (err) is ignored: the execution reaches the end...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This has indeed landed in 12.0.3 👍 thanks for confirming and the reproductions provided!
Hey guys! after a little bit of research, I found that the bug is caused by object destructuring the error recieved in the catch clause of the statement.
So instead of doing this:
Just avoid destructuring:
Hope this solves the problem for everyone. Cheers!