getCode() or $status = 500; $message = $Ex->getMessage(); if( ( isset($_SERVER['HTTP_X_REQUESTED_WITH']) && 'XMLHttpRequest' === $_SERVER['HTTP_X_REQUESTED_WITH'] ) ){ $type = 'application/json; charset=UTF-8'; $body = json_encode( compact('status','message') ); } else { $type = 'text/html; charset=UTF-8'; $body = '