origo-map / origo

Origo
Other
48 stars 53 forks source link

Search control fails silently on 429 (Too Many Requests) #1999

Open MattiasSp opened 4 months ago

MattiasSp commented 4 months ago

Description When making too many requests to a search endpoint (such as Origo Server after https://github.com/origo-map/origo-server/pull/108/commits/580f9b8a0d15d02e046581590893e1390b370278) the client can recieve a 429 - Too Many Requests - response. The search control does not give the user any useful feedback in these cases, failing silently instead.

To Reproduce Steps to reproduce the behavior:

  1. Make more than 100 requests to an Origo Server endpoint within the 15 minute window using the Search control.
  2. See the client give no reaction at all, while logging the 429 error and VM2401:1 Uncaught (in promise) SyntaxError: Unexpected token 'T', "Too many r"... is not valid JSON to the console.

Expected behavior A discrete visual feedback about the cause of the error, perhaps even with info about "try again in X seconds".

MattiasSp commented 4 months ago

If this is something that could/should be solved by a toaster message, would it make sense to make the toaster function in infowindow_exporthandler.js into a more generalized utility function and reuse that?

johnnyblasta commented 4 months ago

The limit should be raised in origo-server, but that doesn't solve if the new limit is reached.

MattiasSp commented 4 months ago

I found the discussion in https://github.com/origo-map/origo/issues/1982 and could just add this issue as another occasion where a general purpose toaster would be useful :)

The fix for this would be very easy to implement if https://github.com/origo-map/origo/pull/1990 gets merged.