mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Refine _.isError checks to avoid false positives on plain objects.
This commit is contained in:
@@ -88,6 +88,7 @@
|
||||
arrayTag = '[object Array]',
|
||||
boolTag = '[object Boolean]',
|
||||
dateTag = '[object Date]',
|
||||
domExcTag = '[object DOMException]',
|
||||
errorTag = '[object Error]',
|
||||
funcTag = '[object Function]',
|
||||
genTag = '[object GeneratorFunction]',
|
||||
@@ -11584,8 +11585,9 @@
|
||||
if (!isObjectLike(value)) {
|
||||
return false;
|
||||
}
|
||||
return (baseGetTag(value) == errorTag) ||
|
||||
(typeof value.message == 'string' && typeof value.name == 'string');
|
||||
var tag = baseGetTag(value);
|
||||
return tag == errorTag || tag == domExcTag ||
|
||||
(typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user