convert error to exception