enhance exception to support error code