question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v12.0.1 error: not implemented: regenerator: complex pattern in catch clause

See original GitHub issue

What 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:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
timneutkenscommented, Nov 6, 2021

This has indeed landed in 12.0.3 👍 thanks for confirming and the reproductions provided!

1reaction
luisorbaicetacommented, Nov 5, 2021

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:

...
} catch ({errors}) {
    console.log(errors)
}

Just avoid destructuring:

...
} catch (error) {
    console.log(error.errors)
}

Hope this solves the problem for everyone. Cheers!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found