Gaurav Jain
Gaurav Jain

Reputation: 415

Difference between Timeout vs Context cancelled Error

What is the difference between Timeout vs Context canceled Error? Can someone help with a detailed answer with examples?

Upvotes: 0

Views: 45

Answers (1)

Muneem Baig
Muneem Baig

Reputation: 16

A Timeout Error happens when a task takes too long to finish. If something like a network request or a database query exceeds the time limit set for it, the system stops the operation and shows a timeout error. For example, if an API request is supposed to finish in 2 seconds but takes longer, it will give a timeout error.

A Context Cancelled Error occurs when the operation is manually stopped before it finishes. This usually happens when the user or the program decides to cancel the task for some reason, like if a user cancels a file upload. The operation stops immediately, and the system returns a context cancelled error.

Upvotes: 0

Related Questions