Skip to content

Commit 6c95ab5

Browse files
committed
Catch exception for Function toString on Proxies etc.
1 parent bd8f4ad commit 6c95ab5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/util.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,12 @@ export function getCustomComponentDefinitionDetails (def) {
245245
}
246246

247247
export function getCustomFunctionDetails (func) {
248-
const string = Function.prototype.toString.call(func) || ''
248+
const string = ''
249+
try {
250+
string = Function.prototype.toString.call(func)
251+
} catch (e) {
252+
// Func is probably a Proxy, which can break Function.prototype.toString()
253+
}
249254
const matches = string.match(/\(.*\)/)
250255
const args = matches ? matches[0] : '(?)'
251256
return {

0 commit comments

Comments
 (0)