If an exception is thrown or an error is raised during HookContainer
construction, don't be surprised when you can't get a HookContainer.
When checking if we need to roll back transactions, use peekService()
instead of isDisabled(). According to the disableService()
documentation, peekService() will always return null for a disabled
service. If the service hasn't been created, there can be no
transactions open and so there is no point in rolling back.
It's not necessary to catch DBError exceptions from peekService(),
since it never calls the instantiator.
Fix phan error by broadening the onLogException() parameter type. Phan
is correct, the parameter is not guaranteed to be
Exception|ErrorException and so the previous documentation was wrong.
Bug: T379125
Change-Id: Ie5ec2bd1ecfb0114f3d00fc28b2c5e3db9bd87c0
(cherry picked from commit 5cf3cd03dfd3f7acca4d78bf12054f3c315fee28)