Skip to content

Commit

Permalink
Fixed exception on javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
solital committed Mar 16, 2024
1 parent 9a54695 commit 2e1a345
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Released Notes

## v3.1.2 - (2024-03-16)

### Fixed

- Fixed exception on JavaScript
- Fixed version on `composer.json`

--------------------------------------------------------------------------

## v3.1.1 - (2024-03-11)

### Fixed
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "brenno-duarte/modern-php-exception",
"description": "PHP errors in a modern way",
"license": "MIT",
"version": "3.1.2",
"keywords": [
"exception",
"throwable",
Expand Down
2 changes: 1 addition & 1 deletion src/ModernPHPException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ModernPHPException
use HandlerAssetsTrait;
use RenderTrait;

public const VERSION = "3.1.0";
public const VERSION = "3.1.2";

/**
* @var Bench
Expand Down
6 changes: 4 additions & 2 deletions src/Trait/RenderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,11 @@ private function renderSolutionCli(): void
public function consoleJS(): void
{
if ($this->type == "error") {
echo "console.error('[" . $this->getError() . "] " . $this->info_error_exception['message'] . "')" . PHP_EOL;
$message = str_replace(["'", '"'], "", $this->info_error_exception['message']);
echo "console.error('[" . $this->getError() . "] " . $message . "')" . PHP_EOL;
} elseif ($this->type == "exception") {
echo "console.error('[" . $this->info_error_exception['type_exception'] . "] " . $this->info_error_exception['message'] . "')" . PHP_EOL;
$message = str_replace(["'", '"'], "", $this->info_error_exception['message']);
echo "console.error('[" . $this->info_error_exception['type_exception'] . "] " . $message . "')" . PHP_EOL;
}

echo 'var user = {
Expand Down
6 changes: 6 additions & 0 deletions tests/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,10 @@ public static function staticCall()
{
throw new CustomException("Error Processing Request");
}

public function triggerTest()
{
//echo $a;
trigger_error("This is a trigger_error test", E_USER_ERROR);
}
}

0 comments on commit 2e1a345

Please sign in to comment.