Revert "Revert "Redirect to SQLError""

This reverts commit 47afa6b9f64f22cf348f973c20c11ede50caa3d9, reversing
changes made to f525aa6467be0694b390bc01f5ee085beadcdc1c.