Previously, `result` was checked before handling the `Error` returned by
`callSPSWrapper`. If `Error` was `success` but `result` indicated
failure, the original `Error` was silently dropped, triggering an
assertion failure for unhandled `Error`.
This patch ensures the `Error` is checked and returned before inspecting
`result`, preventing assertion failures.
Co-authored-by: Anutosh Bhat <andersonbhat491@gmail.com>