Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Suppress error messages for missing raster tiles #161

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/source/source_cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,9 @@ class SourceCache extends Evented {
_tileLoaded(tile: Tile, id: string, previousState: TileState, err: ?Error) {
if (err) {
tile.state = 'errored';
if ((err: any).status !== 404) this._source.fire(new ErrorEvent(err, {tile}));
// continue to try loading parent/children tiles if a tile doesn't exist (404)
const status = (err: any).status;
if (status !== 404 && status !== 204) this._source.fire(new ErrorEvent(err, {tile}));
// continue to try loading parent/children tiles if a tile doesn't exist(404) or has no content (204)
else this.update(this.transform);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/util/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function makeFetchRequest(requestParameters: RequestParameters, callback: Respon
const requestTime = Date.now();

window.fetch(request).then(response => {
if (response.ok) {
if (response.ok && response.status !== 204) {
const cacheableResponse = cacheIgnoringSearch ? response.clone() : null;
return finishRequest(response, cacheableResponse, requestTime);

Expand Down Expand Up @@ -215,7 +215,7 @@ function makeXMLHttpRequest(requestParameters: RequestParameters, callback: Resp
callback(new Error(xhr.statusText));
};
xhr.onload = () => {
if (((xhr.status >= 200 && xhr.status < 300) || xhr.status === 0) && xhr.response !== null) {
if (((xhr.status >= 200 && xhr.status < 300 && xhr.status != 204) || xhr.status === 0) && xhr.response !== null) {
let data: mixed = xhr.response;
if (requestParameters.type === 'json') {
// We're manually parsing JSON here to get better error messages.
Expand Down