Convert errors to exceptions