Pass path and error code to exceptions