Exemplo n.º 1
0
 public function onError(ConnectionInterface $conn, \Exception $e)
 {
     // The connection is closed, remove it, as we can no longer send it messages
     $this->clients->detach($conn);
     echo "An error has occurred: {$e->getMessage()}\n";
     $conn->close();
 }
Exemplo n.º 2
0
 public static function exceptionHandler(\Exception $exception)
 {
     $template = new Template('error.twig');
     $template->title = 'Error';
     $template->alert('danger', $exception->getMessage());
     $template->e = $exception;
     $template->render(true);
 }
Exemplo n.º 3
0
 public static function on_exception_rescue(\ICanBoogie\Exception\RescueEvent $event, \Exception $target)
 {
     try {
         $code = $target->getCode();
         if ($code < 100 || $code >= 600) {
             $code = Status::INTERNAL_SERVER_ERROR;
         }
         $event->response = new Response(self::render_exception($target), $code);
     } catch (\Exception $e) {
         #
         # we can't provide better… too bad
         #
     }
 }
Exemplo n.º 4
0
 /**
  * Error handler
  *
  * @param  \Exception $exception
  * @return void
  */
 public function error(\Exception $exception)
 {
     $message = strip_tags($exception->getMessage());
     if (stripos(PHP_OS, 'win') === false) {
         $string = "        " . str_repeat(' ', strlen($message)) . "    " . PHP_EOL;
         $string .= "        " . $message . "    " . PHP_EOL;
         $string .= "        " . str_repeat(' ', strlen($message)) . "    " . PHP_EOL . PHP_EOL;
         $string .= "    Try ./app help for help" . PHP_EOL . PHP_EOL;
     } else {
         $string = $message . PHP_EOL . PHP_EOL;
         $string .= '    Try \'./app help\' for help' . PHP_EOL . PHP_EOL;
     }
     echo $string;
     exit(127);
 }
Exemplo n.º 5
0
 public function run()
 {
     DB::table('exceptions')->delete();
     Exception::create(['title' => 'firstTimeFarmer', 'message' => 'Applicant has a year or less of farming history']);
     Exception::create(['title' => 'farmerHistory', 'message' => 'Applicant has less than 3 years of farming history.']);
     Exception::create(['title' => 'outstandingLoan', 'message' => 'Applicant has outstanding loans at ARM.']);
     Exception::create(['title' => 'previousAddendum', 'message' => 'Applicant utilized loan addendums in previous year:']);
     Exception::create(['title' => 'plantOwn', 'message' => 'Applicant does not plant his own crops.']);
     Exception::create(['title' => 'harvestOwn', 'message' => 'Applicant does not harvest his own crop.']);
     Exception::create(['title' => 'equipmentObligations', 'message' => 'Applicant does not have all equipment obligations met.']);
     Exception::create(['title' => 'cashOutlayProvisions', 'message' => 'Applicant has not made provisions for all cash outlays.']);
     Exception::create(['title' => 'fsaGoodStanding', 'message' => 'Applicant is not in good standing with FSA.']);
     Exception::create(['title' => 'fmaGoodStanding', 'message' => 'Applicant is not in good standing with Federal Crop Insurance (RMA).']);
     Exception::create(['title' => 'pastDuePremiums', 'message' => 'Applicant has Crop Insurance premiums past due.']);
     Exception::create(['title' => 'isDefendant', 'message' => 'Applicant is defendant in legal actions.']);
     Exception::create(['title' => 'outstandingJudgement', 'message' => 'Applicant has judgements outstanding.']);
     Exception::create(['title' => 'bankruptcyHistory', 'message' => 'Applicant has been previously involved in a bankruptcy.']);
     Exception::create(['title' => 'bankruptcyOrder', 'message' => 'This loan requires a Banruptcy Order to incur debt.']);
     Exception::create(['title' => 'outstandingLiens', 'message' => 'There are outstanding liens on the mortgaged crop.']);
     Exception::create(['title' => 'contractualObligations', 'message' => 'There are outstanding contractual obligations.']);
     Exception::create(['title' => 'notGradeA', 'message' => "Applicant is rated less than as an 'A'"]);
     Exception::create(['title' => 'thirdPartyCredit', 'message' => 'Third Party Credit other than Interest was utilized.']);
     Exception::create(['title' => 'bookedCrops', 'message' => 'More crop was booked than was insured (acres x APH x level)']);
     Exception::create(['title' => 'producesPeanuts', 'message' => 'This loan includes the production of peanuts.']);
     Exception::create(['title' => 'producesSugarCane', 'message' => 'This loan includes the production of sugar cane.']);
     Exception::create(['title' => 'yieldHistory', 'message' => 'No actual yield history existed - T-yield was used']);
     Exception::create(['title' => 'cashRentWaivers', 'message' => 'Cash Rent waivers were utilized.']);
     Exception::create(['title' => 'variableHarvesting', 'message' => 'Variable harvesting expenses was utilized.']);
     Exception::create(['title' => 'rentExpenses', 'message' => 'Certain farms have no rent expense allocated.']);
     Exception::create(['title' => 'cropBreakEven', 'message' => 'Applicant has yield history that is less than break-even']);
     Exception::create(['title' => 'nonstandardDueDate', 'message' => 'Due Date is non-standard.']);
     Exception::create(['title' => 'nonstandardCropDiscount', 'message' => 'Projected crops discount rate used is non-standard.']);
     Exception::create(['title' => 'nonstandardFsaAssignment', 'message' => 'FSA assignment discount rate used is non-standard.']);
     Exception::create(['title' => 'nonstandardCropInsuranceDiscount', 'message' => 'Crop Insurance discount rate used is non-standard.']);
     Exception::create(['title' => 'nonstandardEquipmentDiscount', 'message' => 'Equipment discount rate used is non-standard.']);
     Exception::create(['title' => 'nonstandardRealEstateDiscount', 'message' => 'Real-Estate discount rate used is non-standard.']);
     Exception::create(['title' => 'nonstandardClaimsDiscount', 'message' => 'Claims discount rate used is non-standard.']);
     Exception::create(['title' => 'nonstandardServiceFee', 'message' => 'Service Fee is non-standard']);
     Exception::create(['title' => 'serviceFeeNotOnTotal', 'message' => 'Service Fee is not charged on the total commitment.']);
     Exception::create(['title' => 'nonstandardProcessingFee', 'message' => 'Processing Fee is non-standard']);
     Exception::create(['title' => 'processingFeeNotOnTotal', 'message' => 'Processing Fee is not charged on the total commitment']);
     Exception::create(['title' => 'nonstandardArmInterest', 'message' => 'ARM Interest Rate is non-standard.']);
     Exception::create(['title' => 'differingInterestRates', 'message' => 'ARM Interest Rate and Distributor Interest Rate are not the same.']);
     Exception::create(['title' => 'nonRPInsurance', 'message' => 'Crop Insurance other than RP is being used.']);
     Exception::create(['title' => 'cropInsuranceShare', 'message' => 'Crop Insurance share used is greater than the applicants share of operation']);
     Exception::create(['title' => 'wholeFarmExpenses', 'message' => 'Whole farm expenses have been utilized and not directly allocated for each crop.']);
     Exception::create(['title' => 'noGuarantors', 'message' => 'Personal Guarantees are being relied upon by this loan.']);
     Exception::create(['title' => 'equipmentCollateral', 'message' => 'This loan relies upon equipment as collateral.']);
     Exception::create(['title' => 'realEstateCollateral', 'message' => 'This loan relies upon real estate as collateral.']);
     Exception::create(['title' => 'insuranceClaimCollateral', 'message' => 'This loan relies upon outstanding Crop Insurance Claims as collateral.']);
     Exception::create(['title' => 'negativeCashFlow', 'message' => 'Loan has negative cash flow.']);
     Exception::create(['title' => 'riskMargin', 'message' => "Loan's Risk Margin is less than 5% or Loans Risk Margin is less than 0."]);
     Exception::create(['title' => 'insufficientValueARM', 'message' => 'The crop insurance forecaset plus FSA payments do not exceed the value of ARM Commitment.']);
     Exception::create(['title' => 'insufficientValueTotal', 'message' => 'The crop insurance forecast plus FSA payments do not exceed the value of Total Commitment']);
     Exception::create(['title' => 'balanceSheetLessArm', 'message' => "The balance sheet shows less Net Worth than the ARM Commitment"]);
     Exception::create(['title' => 'balanceSheetNetWorth', 'message' => "The Balance Sheet shows negative net worth."]);
     Exception::create(['title' => 'crossCollateralized', 'message' => 'This is a cross-collateralized loan.']);
     Exception::create(['title' => 'controlledDisbursment', 'message' => 'This is a controlled disbursement loan.']);
 }
Exemplo n.º 6
0
 public function update($id)
 {
     // save updated
     $record = $this->records->find($id);
     if (!$record) {
         Exception::create(Input::all());
         return $this->respond($record);
     }
     $record->fill(Input::all())->save();
     return $this->respond($record);
 }
Exemplo n.º 7
0
 public function onError(ConnectionInterface $conn, \Exception $e)
 {
     echo "An error has occurred: {$e->getMessage()}\n";
     $conn->close();
 }
Exemplo n.º 8
0
 public function __invoke(Request $request, Response $response, \Exception $exception)
 {
     // Log the message
     $this->logger->critical($exception->getMessage());
     return parent::__invoke($request, $response, $exception);
 }
Exemplo n.º 9
0
 /**
  * Shows caught exception in a nice view.
  * @param \App\Exception\HttpException|\Exception $exception
  * @return null
  */
 public function handle_error_request(\Exception $exception)
 {
     if (!function_exists('apache_request_headers')) {
         function apache_request_headers()
         {
             $arh = array();
             $rx_http = '/\\AHTTP_/';
             foreach ($_SERVER as $key => $val) {
                 if (preg_match($rx_http, $key)) {
                     $arh_key = preg_replace($rx_http, '', $key);
                     $rx_matches = array();
                     // do some nasty string manipulations to restore the original letter case
                     // this should work in most cases
                     $rx_matches = explode('_', $arh_key);
                     if (count($rx_matches) > 0 and strlen($arh_key) > 2) {
                         foreach ($rx_matches as $ak_key => $ak_val) {
                             $rx_matches[$ak_key] = ucfirst($ak_val);
                         }
                         $arh_key = implode('-', $rx_matches);
                     }
                     $arh[$arh_key] = $val;
                 }
             }
             return $arh;
         }
     }
     try {
         $response = null;
         $request = null;
         if ($exception instanceof HttpException) {
             $request = $exception->getParameter('request');
         }
         $event = new GetResponseEvent($request, $request ? $request->cookie() : []);
         $event->setException($exception);
         $this->dispatcher->dispatch(Events::KERNEL_PRE_HANDLE_EXCEPTION, $event);
         if ($event->getResponse()) {
             $response = $event->getResponse();
         }
         if (!$response) {
             $isAdmin = $exception instanceof HttpException && $exception->getParameter('request') && $exception->getParameter('request')->isAdminPath() && $this->auth->has_role('admin');
             if ($isAdmin) {
                 $route_data = $this->router->match('/admin/error/' . $exception->getCode());
             } else {
                 $route_data = $this->router->match('/error/' . $exception->getCode());
             }
             $route_data['params'] = array_merge($route_data['params'], ['exception' => $exception]);
             $request = $this->request($route_data['route'], $_SERVER['REQUEST_METHOD'], $_POST, $_GET, $route_data['params'], $_SERVER, $_COOKIE, apache_request_headers());
             $response = $request->execute();
         }
         $response->send_headers()->send_body();
     } catch (\Exception $e) {
         $this->handle_exception($e);
     }
 }
Exemplo n.º 10
0
 /**
  * Shows caught exception in a nice view.
  * @param \App\Exception\HttpException|\Exception $exception
  * @return null
  */
 public function handle_error_request(\Exception $exception)
 {
     try {
         $response = null;
         $request = null;
         if ($exception instanceof HttpException) {
             $request = $exception->getParameter('request');
         }
         $event = new GetResponseEvent($request, $request ? $request->getCookie() : []);
         $event->setException($exception);
         $this->dispatcher->dispatch(Events::KERNEL_PRE_HANDLE_EXCEPTION, $event);
         if ($event->getResponse()) {
             $response = $event->getResponse();
         }
         if (!$response) {
             $isAdmin = $exception instanceof HttpException && $exception->getParameter('request') && $exception->getParameter('request')->isAdminPath() && $this->auth->has_role('admin');
             if ($isAdmin) {
                 $route_data = $this->router->match('/admin/error/' . $exception->getCode());
             } else {
                 $route_data = $this->router->match('/error/' . $exception->getCode());
             }
             $route_data['params'] = array_merge($route_data['params'], ['exception' => $exception]);
             $request = $this->request($route_data['route'], $_SERVER['REQUEST_METHOD'], $_POST, $_GET, $route_data['params'], $_SERVER, $_COOKIE);
             $response = $request->execute();
         }
         $response->send_headers()->send_body();
     } catch (\Exception $e) {
         $this->handle_exception($e);
     }
 }
Exemplo n.º 11
0
 /**
  * Custom error handler method
  *
  * @param  \Exception $exception
  * @return void
  */
 public function error(\Exception $exception)
 {
     $view = new View(__DIR__ . '/../view/exception.phtml');
     $view->title = 'Application Error';
     $view->message = htmlentities(strip_tags($exception->getMessage()), ENT_QUOTES, 'UTF-8');
     if (file_exists(__DIR__ . '/../config/application.php')) {
         $config = (include __DIR__ . '/../config/application.php');
         $view->application_title = $config['application_title'];
     } else {
         $view->application_title = '';
     }
     $response = new Response();
     $response->setBody((string) $view);
     $response->send(500);
 }
Exemplo n.º 12
0
 /**
  * @param \Exception $e
  */
 protected function logException(\Exception $e)
 {
     \Log::error($e->getMessage() . ' in ' . $e->getFile() . ':' . $e->getLine() . "\n" . $e->getTraceAsString() . "\n" . str_repeat('=', 80) . "\n");
 }