Handle CORS errors / documentation
robbeofficial opened this issue · comments
i do not understand how it is possible to handle CORS errors like "No 'Access-Control-Allow-Origin' header is present on the requested resource." the callback provided by ID3.loadTags is only called on success.
i assume it's somehow possible with the dataReader option but could not yet figure out how.
You're right, I completely forgot about that. The XHR data reader does receive an error callback function and it calls it but ID3 was never using it.
I've added a new onError
option to loadTags
. This function will be called with a reason object. The reason object has an error
property that describes the error. If the error is "xhr"
then an aditional xhr
property is available with the XHR object.
I've put it in a branch first: https://github.com/aadsm/JavaScript-ID3-Reader/tree/gh-28_error-handling
This has been fixed by 4978f96