Raises Torch::Error if the shim recorded an error for the last call.
Returns and clears the last shim error on this thread (set by PROTECT).