Then what you have is pretty good. Assuming you've got a reliable branch based on error code (which you appear to), you could then use that as a dispatch so that the processing function itself had no knowledge of the errors themselves. Just go one step farther and take the error code (once you know that's what you've got) and pass it in to some error-handling function which either knows, or has access to a table of some kind that knows how to handle individual errors. That keeps your driver function sufficiently generic that it could handle anything as long as "errors are always negative numbers."