Throw exception when context is null