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

Harden error handling when wms layers get map requests fails despite 200 ok #10701

Closed
1 task done
MV88 opened this issue Nov 29, 2024 · 0 comments · Fixed by #10702 or #10755
Closed
1 task done

Harden error handling when wms layers get map requests fails despite 200 ok #10701

MV88 opened this issue Nov 29, 2024 · 0 comments · Fixed by #10702 or #10755
Assignees
Labels
Accepted BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch enhancement
Milestone

Comments

@MV88
Copy link
Contributor

MV88 commented Nov 29, 2024

Description

There is a scenario where the get map returns an 200 ok with the xml content containing an exception.
In this case where headers are configured to use bearer token it will enter line 78 despite the content being an xml exception

if (headers) {
axios.get(newSrc, {
headers,
responseType: 'blob'
}).then(response => {
if (response.status === 200 && response.data) {
image.getImage().src = URL.createObjectURL(response.data);
} else {
console.error("Status code: " + response.status);
}
}).catch(e => {
console.error(e);
});
} else {
img.src = newSrc;
}

this must be handled making sure it will dispatch a layer load error entering line 314

imageLoadEndStream$
.bufferWhen(() => imageStopStream$)
.subscribe({
next: (imageEvents) => {
const errors = imageEvents.filter(e => e.type === 'imageloaderror');
if (errors.length > 0) {
this.props.onLayerLoad(options.id, {error: true});
if (options && !options.hideErrors || !options) {
this.props.onLayerError(options.id, imageEvents.length, errors.length);
}
} else {
this.props.onLayerLoad(options.id);
}
}
});

this should

How to reproduce

  • this currently happens in a project and it require time to find a scenario to reproduce it in mapstore
  • anyway, if a wms layers generate a wms error, (maybe for a style that is missing)
  • it should generate this use case if not other ways have to be found

Expected Result

  • to have dispatched the layer load error
  • layers should stop rendering, should be hidden until an update to the view triggers an update of the layer so new requests comes in and a new check can be done

Current Result

nothing happens, layers remain rendered in the mapo

  • Not browser related
Browser info (use this site: https://www.whatsmybrowser.org/ for non expert users)
Browser Affected Version
Internet Explorer
Edge
Chrome
Firefox
Safari

Other useful information

@MV88 MV88 added the bug label Nov 29, 2024
@MV88 MV88 self-assigned this Nov 29, 2024
@MV88 MV88 added this to the 2024.02.02 milestone Nov 29, 2024
@tdipisa tdipisa added enhancement and removed bug labels Nov 29, 2024
MV88 added a commit to MV88/MapStore2 that referenced this issue Nov 29, 2024
@tdipisa tdipisa modified the milestones: 2024.02.02, 2025.01.00 Dec 4, 2024
@tdipisa tdipisa added the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Dec 4, 2024
@ElenaGallo ElenaGallo self-assigned this Jan 13, 2025
MV88 added a commit to MV88/MapStore2 that referenced this issue Jan 14, 2025
tdipisa pushed a commit that referenced this issue Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment