This part is taken directly from PHP's manual example (not user comments). What about passing errorCode as exception code?