Skip to content

New throwing behavior of ajax-read #462

Open
@danielsz

Description

@danielsz

Sente will throw an error when an ajax timeout occurs. This behavior was introduced recently, with 9da662c.

This is a reasonable decision, however I would like to make a couple of comments and raise a couple of questions.

  1. Most of the ajax timeouts I am seeing result from stale connections due to prolonged inactivity, for example, myself coming back to the browser after my laptop resumed from sleep. This cause for the error I consider benign.
  2. Logs on a busy production server will show many of those uncaught errors over time.
  3. We should probably explain that this is going to happen in the README, and show how to catch the error and where. Examples should be given.
  4. The ex-data for now contains only the value of :timeout-msecs. It should be enhanced with data from the request such as its origin. Presumably available from the function argument sch but I am currently blanking as to what and how much information can be recalled from that.

Another perspective on this is the following:

  • Do not throw the error by default, but as an opt-in setting in Sente's constructor.
  • Motivation is quality of life for the developer.
  • The assumption here is that most readout errors are harmless and more importantly, unrecoverable.
  • Throwing the error is probably reserved for debugging.

That's it from me as for this issue. I'll be happy to hear what you all think.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions