Skip to content

Commit

Permalink
[HOTFIX][FE] Properly handling error for loading modal (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicklas373 committed May 12, 2024
2 parents 8358413 + 9fc5c7e commit 5a042d5
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function render($request, Throwable $exception)
if ($route && method_exists($route, 'methods')) {
$methods = $route->methods();
$message = 'MethodNotAllowedHttpException for route: ' . $uri . ' (' . implode(', ', $methods) . ')';
NotificationHelper::Instance()->sendRouteErrNotify($uuid, 'FAIL', 'Method not allowed exception!', $currentRouteInfo, $message, $userIp);
Log::error($message);
try {
DB::table('appLogs')->insert([
'processId' => $uuid,
Expand All @@ -74,7 +74,7 @@ public function render($request, Throwable $exception)
}
} else {
$message = 'MethodNotAllowedHttpException for route: ' . $uri;
NotificationHelper::Instance()->sendRouteErrNotify($uuid, 'FAIL', 'Method not allowed exception!', 'null', $message, $userIp);
Log::error($message);
try {
DB::table('appLogs')->insert([
'processId' => $uuid,
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/build/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
]
},
"resources/js/kao-logic.js": {
"file": "assets/kao-logic-DwIvi7le.js",
"file": "assets/kao-logic-Bp6_TJmE.js",
"name": "kao-logic",
"src": "resources/js/kao-logic.js",
"isEntry": true,
Expand Down
7 changes: 6 additions & 1 deletion resources/js/kao-logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1061,13 +1061,15 @@ function sendToAPI(files, proc, action) {
`
document.getElementById("scsMsgLink").href = apiUrl+xhrReturn.fileSource
document.getElementById("scsMsgLink").innerText = "Download PDF"
resolve()
} else {
document.getElementById("alert-scs").classList.remove("hidden","opacity-0")
document.getElementById("alert-err").classList.add("hidden","opacity-0")
document.getElementById("scsMsgTitle").innerText = `HANA PDF Process completed !`
document.getElementById("scsMsgResult").innerText = `Download the file or PDF below.`
document.getElementById("scsMsgLink").href = apiUrl+xhrReturn.fileSource
document.getElementById("scsMsgLink").innerText = "Download PDF"
resolve()
}
} else {
document.getElementById("alert-scs").classList.add("hidden","opacity-0")
Expand All @@ -1076,6 +1078,7 @@ function sendToAPI(files, proc, action) {
document.getElementById("errMsg").innerText = xhrReturn.message
document.getElementById("errProcMain").classList.remove("hidden")
document.getElementById("errProcId").innerText = xhrReturn.processId
reject(new Error('API response: '+xhrReturn.errors+' !')) //Force stop loadingModal while return error !
}
} else {
document.getElementById("alert-scs").classList.add("hidden","opacity-0")
Expand All @@ -1084,15 +1087,16 @@ function sendToAPI(files, proc, action) {
document.getElementById("errMsg").innerText = xhrReturn.message
document.getElementById("errProcMain").classList.remove("hidden")
document.getElementById("errProcId").innerText = xhrReturn.processId
reject(new Error('API response: '+xhrReturn.status+' !')) //Force stop loadingModal while return error !
}
resolve()
} else {
document.getElementById("alert-scs").classList.add("hidden","opacity-0")
document.getElementById("alert-err").classList.remove("hidden","opacity-0")
document.getElementById("errMsgTitle").innerText = "HANA PDF Process failed !"
document.getElementById("errMsg").innerText = xhrReturn.message
document.getElementById("errProcMain").classList.remove("hidden")
document.getElementById("errProcId").innerText = xhrReturn.processId
reject(new Error('API response: '+xhr.status+' !')) //Force stop loadingModal while return error !
}
}
} else {
Expand All @@ -1102,6 +1106,7 @@ function sendToAPI(files, proc, action) {
document.getElementById("errMsg").innerText = "There was unexpected error !, please try again later."
document.getElementById("errProcMain").classList.add("hidden")
reject(new Error('API response error !'))
loadingModal.hide() //Force stop loadingModal while return error !
}
}
xhr.send(formData)
Expand Down
2 changes: 1 addition & 1 deletion resources/views/layouts/alternate-layout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div id="content" class="flex flex-col min-h-screen justify-between">
@yield('content')
</div>
<script async type="module" src="{{asset('build/assets/kao-logic-DwIvi7le.js')}}"></script>
<script async type="module" src="{{asset('build/assets/kao-logic-Bp6_TJmE.js')}}"></script>
<script async type="module" src="https://unpkg.com/pdfjs-dist@4.0.379/build/pdf.mjs"></script>
<script async type="module" src="https://unpkg.com/pdfjs-dist@4.0.379/build/pdf.worker.mjs"></script>
<script async type="text/javascript" src="{{asset('ext-js/kao-controller.js')}}"></script>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/layouts/main-layout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div id="content" class="flex flex-col min-h-screen justify-between">
@yield('content')
</div>
<script async type="module" src="{{asset('build/assets/kao-logic-DwIvi7le.js')}}"></script>
<script async type="module" src="{{asset('build/assets/kao-logic-Bp6_TJmE.js')}}"></script>
<script async type="text/javascript" src="{{asset('ext-js/kao-controller.js')}}"></script>
<script async type="text/javascript" src="{{asset('ext-js/kao-main.js')}}"></script>
<script async type="text/javascript" src="https://unpkg.com/@material-tailwind/html@latest/scripts/ripple.js"></script>
Expand Down

0 comments on commit 5a042d5

Please sign in to comment.