Restore is not a function error

This commit is contained in:
Iván Ovejero 2023-01-20 15:05:41 +01:00
parent e4652e164f
commit ad9f22857d

View File

@ -309,6 +309,19 @@ export class Expression {
) {
throw new Error('invalid syntax');
}
if (
typeof process === 'undefined' &&
error instanceof Error &&
error.name === 'TypeError' &&
error.message.endsWith('is not a function')
) {
const match = error.message.match(/(?<msg>[^.]+is not a function)/);
if (!match?.groups?.msg) return null;
throw new Error(match.groups.msg);
}
}
return null;
}