geoserver-node-client icon indicating copy to clipboard operation
geoserver-node-client copied to clipboard

No exception for expectable HTTP 404 in GET requests

Open chrismayer opened this issue 2 years ago • 1 comments

There are often cases you request an object via HTTP GET - e.g. a layer - in order to check its existence and create it afterwards if not existing. So the HTTP 404 in the GET request is not an exception. It is an expected result, which should be handled differently than raising an exception.

First suggestion as base for a discussion: Adding a flag (notFoundIsOk or similar) to all GET requests, where it might make sense. If an HTTP 404 occurs and the flag is set to true no exception should be raised. Maybe an info log or even something smarter could happen. Default for the flag should be false, to sustain to current behavior.

/cc @JakobMiksch

chrismayer avatar May 09 '22 13:05 chrismayer

Since the version 1.0., expected 404 request are catched. Then undefined is returned. Here an example: https://github.com/meggsimum/geoserver-node-client/blob/1.1.0/src/layer.js#L22-L60 Does this solve the issue?

JakobMiksch avatar Jul 12 '22 15:07 JakobMiksch

Yes, that should solve the issue....thanks. Going to close this now.

chrismayer avatar May 16 '24 07:05 chrismayer