瀏覽代碼

added error handling

= 3 年之前
父節點
當前提交
9b00d51b85
共有 3 個文件被更改,包括 20 次插入2 次删除
  1. 18 0
      app/Exceptions/Handler.php
  2. 0 1
      resources/views/layouts/template.blade.php
  3. 2 1
      spec/rpt-queries.sql

+ 18 - 0
app/Exceptions/Handler.php

@@ -3,6 +3,7 @@
 namespace App\Exceptions;
 
 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
+use Illuminate\Support\Facades\Http;
 use Throwable;
 
 class Handler extends ExceptionHandler
@@ -36,6 +37,7 @@ class Handler extends ExceptionHandler
      */
     public function report(Throwable $exception)
     {
+        $this->reportError($exception);
         parent::report($exception);
     }
 
@@ -52,4 +54,20 @@ class Handler extends ExceptionHandler
     {
         return parent::render($request, $exception);
     }
+
+    private function reportError(Throwable $e){
+        try {
+            $url =   config('stag.backendUrl') . '/dev/reportPhpError';
+            $headers['secret'] = 'superman';
+            Http::asForm()
+                ->withHeaders($headers)
+                ->post($url, [
+                    'data'=>'FE2: '.$e->getMessage(),
+                    'secret' => 'superman'
+                ])
+                ->json();
+        }catch(\Exception $e){
+            //do nothing
+        }
+    }
 }

+ 0 - 1
resources/views/layouts/template.blade.php

@@ -1,6 +1,5 @@
 <!DOCTYPE html>
 <html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
-
 <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1">

+ 2 - 1
spec/rpt-queries.sql

@@ -130,4 +130,5 @@ WHERE days_between_most_recent_mcp_note_date_and_end_of_care_month IS NULL AND m
 
 
 UPDATE care_month SET most_recent_mcp_note_date = (SELECT effective_dateest FROM note WHERE note.client_id = care_month.client_id AND is_signed_by_hcp IS TRUE AND is_cancelled IS NOT TRUE AND effective_dateest <  ((date_trunc('month', start_date) + interval '1 month' - interval '1 day')::date) ORDER BY effective_dateest DESC LIMIT 1)
-WHERE most_recent_mcp_note_date IS NULL;
+WHERE most_recent_mcp_note_date IS NULL;
+