Reputation: 43
after compile my page it shows an error that said:
wait - compiling...
thread '' panicked at 'not implemented: regenerator: complex pattern in catch clause', C:\Users\runneradmin.cargo\registry\src\github.com-1ecc6299db9ec823\swc_ecma_transforms_compat-0.47.1\src\es2015\regenerator\case.rs:1232:30
error - ./pages/auth/index.tsx
Error: failed to process not implemented: regenerator: complex pattern in catch clause
maybe its cause by SWC but it so ambiquous and nothing help me to figure out what exactly caused this error !
Upvotes: 1
Views: 409
Reputation: 43
beacuse we use {} in catch block and swc cant figure out what is destructuring !
const handleSubmit = useMutation(async () => {
try {
const res = await gate.register({ username: phoneNumber });
setstep((prev) => prev + 1);
toast.success(res.message);
} catch ({ data: { errors } }) { // this line throw error remove {data:{error}} and put just e
showErrorMessage(errors);
}
});
true implemention
const handleSubmit = useMutation(async () => {
try {
const res = await gate.register({ username: phoneNumber });
setstep((prev) => prev + 1);
toast.success(res.message);
} catch (e) { // this line throw error remove {data:{error}} and put just e
showErrorMessage(e.data.error);
}
});
Upvotes: 1