Browse Source

Better error messaging

shalvah 4 years ago
parent
commit
e2bea2f677

+ 1 - 1
resources/js/tryitout.js

@@ -114,7 +114,7 @@ function handleError(form, endpointId, err) {
     // Show error views
     let errorMessage = err.message || err;
     errorMessage += "\n\nTip: Check that you're properly connected to the network.";
-    errorMessage += "\nIf you're a maintainer of ths API, verify that you've enabled CORS.";
+    errorMessage += "\nIf you're a maintainer of ths API, verify that your API is running and you've enabled CORS.";
     errorMessage += "\nYou can check the Dev Tools console for debugging information.";
     document.querySelector('#execution-error-message-' + endpointId).textContent = errorMessage;
     const errorEl = document.querySelector('#execution-error-' + endpointId);

+ 2 - 2
src/Extracting/Strategies/Responses/UseApiResourceTags.php

@@ -198,7 +198,7 @@ class UseApiResourceTags extends Strategy
                 return $factory->make();
             }
         } catch (Exception $e) {
-            c::debug("Eloquent model factory failed to instantiate {$type}; trying to fetch from database.");
+            c::warn("Eloquent model factory failed to instantiate {$type}; trying to fetch from database.");
             e::dumpExceptionIfVerbose($e, true);
 
             $instance = new $type();
@@ -211,7 +211,7 @@ class UseApiResourceTags extends Strategy
                     }
                 } catch (Exception $e) {
                     // okay, we'll stick with `new`
-                    c::debug("Failed to fetch first {$type} from database; using `new` to instantiate.");
+                    c::warn("Failed to fetch first {$type} from database; using `new` to instantiate.");
                     e::dumpExceptionIfVerbose($e);
                 }
             }

+ 2 - 2
src/Extracting/Strategies/Responses/UseTransformerTags.php

@@ -178,7 +178,7 @@ class UseTransformerTags extends Strategy
                 return $factory->make();
             }
         } catch (Exception $e) {
-            c::debug("Eloquent model factory failed to instantiate {$type}; trying to fetch from database.");
+            c::warn("Eloquent model factory failed to instantiate {$type}; trying to fetch from database.");
             e::dumpExceptionIfVerbose($e, true);
 
             $instance = new $type();
@@ -191,7 +191,7 @@ class UseTransformerTags extends Strategy
                     }
                 } catch (Exception $e) {
                     // okay, we'll stick with `new`
-                    c::debug("Failed to fetch first {$type} from database; using `new` to instantiate.");
+                    c::warn("Failed to fetch first {$type} from database; using `new` to instantiate.");
                     e::dumpExceptionIfVerbose($e);
                 }
             }