Created
August 27, 2020 20:04
-
-
Save dasl-/d661a7c1d628f771a1876ca165d6d7b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'Loader.php'; | |
use Google\ApiCore\ApiException; | |
try { | |
regularException(); | |
} catch (Exception $e) { | |
echo "regular exception toString:\n"; | |
echo "$e"; | |
echo "\n\n"; | |
echo "regular exception getTraceAsString:\n"; | |
echo $e->getTraceAsString(); | |
echo "\n\n"; | |
} | |
try { | |
googleApiException(); | |
} catch (Exception $e) { | |
echo "google api exception toString:\n"; | |
echo "$e"; | |
echo "\n\n"; | |
echo "google api exception getTraceAsString:\n"; | |
echo $e->getTraceAsString(); | |
echo "\n\n"; | |
} | |
function regularException() { | |
regularException2(); | |
} | |
function regularException2() { | |
throw new Exception("damn"); | |
} | |
function googleApiException() { | |
googleApiException2(); | |
} | |
function googleApiException2() { | |
throw new ApiException("damn", 99, "status"); | |
} | |
// output: | |
// | |
// regular exception toString: | |
// Exception: damn in /home/dleibovic/test.php:33 | |
// Stack trace: | |
// #0 /home/dleibovic/test.php(29): regularException2() | |
// #1 /home/dleibovic/test.php(7): regularException() | |
// #2 {main} | |
// regular exception getTraceAsString: | |
// #0 /home/dleibovic/test.php(29): regularException2() | |
// #1 /home/dleibovic/test.php(7): regularException() | |
// #2 {main} | |
// google api exception toString: | |
// Google\ApiCore\ApiException: damn | |
// google api exception getTraceAsString: | |
// #0 /home/dleibovic/test.php(37): googleApiException2() | |
// #1 /home/dleibovic/test.php(18): googleApiException() | |
// #2 {main} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment