bootstrap-autocomplete icon indicating copy to clipboard operation
bootstrap-autocomplete copied to clipboard

Crash when XHR request fails and no fail handler is defined

Open danports opened this issue 2 years ago • 1 comments

If an XHR request fails without a defined fail handler, the following error is thrown: fail is not a function

It looks like the XHR failure code doesn't check whether fail is actually defined in the settings object: https://github.com/xcash/bootstrap-autocomplete/blob/d9701bf90772f9b9b37246e8df604f15a6969884/src/resolvers.ts#L79

That will check if _settings exists, but not whether fail is defined on that object. A more correct version (we can assume _settings exists here since it has a url we've already requested): this._settings.fail?.(err);

danports avatar Sep 23 '22 02:09 danports