sonic: Improve error codes