RAII wrapper that pushes an op name on construction and pops it on destruction.
Preferred over the manual ErrorContext::push /
ErrorContext::pop pair in any scope that may throw — the
destructor guarantees the stack is balanced even when an exception
propagates through. Move and copy are deleted to forbid transferring
ownership of a stack frame between scopes, which would break the LIFO
invariant.
Parameters
op_namestd::stringIdentifier pushed onto the thread's
ErrorContext stack on construction. The corresponding pop is performed by the destructor.Examples
`
{
ErrorContextGuard guard("conv2d");
// ... any throw inside this scope is tagged "[trace=conv2d]" ...
}
`Constructors
1ctor
ErrorContextGuard
void ErrorContextGuard(int op_name)Pushes op_name onto the thread's ErrorContext stack.
Parameters
op_namestd::stringIdentifier for the in-flight op; moved into the stack.
Destructor
1dtor
~ErrorContextGuard
void ~ErrorContextGuard()Pops the most recently pushed entry.