Add new error types and standardize error handling on container
There are more unique error cases we want to convey to the app (actual implementations are coming), so I think it's time to add some structure here.
I propose that every error raised on container has a property "containerErrorType" (better names are welcome!) which is enum and contain on of the following:
- critical "general" error (almost all errors from ContainerRuntime)
- critical file IO error (all errors from DeltaManager)
- 429 error
- service is experiencing issues (similar to above) (NEW)
- epoch / version error (file has been overwritten) (NEW)
- can't summarize for a while (NEW, will comes from ContainerRuntime)
I think all errors reaching container should be strongly typed (and contain that piece of information). Ideally nobody should be using container.emit("error") and instead use Container.raiseCriticalError(error). But signatures on both should be strongly typed and if callers are dealing with "unknown" errors, they should convert them to strongly typed error.
And each type can contain specific properties for that type (429 contains retryAfter)
We can make error type a union of all specific error types.
@rm-1612 - FYI
@ashwinmayya as FYI
PR: https://github.com/microsoft/FluidFramework/pull/589