Skip to content

Commit 2129ef7

Browse files
committed
Implement AjaxExceptionInterface
1 parent 7bf0222 commit 2129ef7

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

composer.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"php": "^8.0.2",
1818
"composer/composer": "^2.0.0",
1919
"composer/installers": "^1 || ^2",
20+
"larajax/larajax": "dev-main",
2021
"doctrine/dbal": "^2.13.3|^3.1.4",
2122
"intervention/image": "^3.10",
2223
"jaybizzle/crawler-detect": "^1.3",
@@ -67,5 +68,10 @@
6768
}
6869
},
6970
"minimum-stability": "dev",
70-
"prefer-stable": true
71+
"prefer-stable": true,
72+
"config": {
73+
"allow-plugins": {
74+
"composer/installers": true
75+
}
76+
}
7177
}

src/Exception/AjaxException.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php namespace October\Rain\Exception;
22

3+
use Larajax\Contracts\AjaxExceptionInterface;
4+
35
/**
46
* AjaxException is considered a "smart error" and will send http code 406,
57
* so they can pass response contents.
68
*
79
* @package october\exception
810
* @author Alexey Bobkov, Samuel Georges
911
*/
10-
class AjaxException extends ExceptionBase
12+
class AjaxException extends ExceptionBase implements AjaxExceptionInterface
1113
{
1214
/**
1315
* @var array contents of the response.
@@ -46,4 +48,12 @@ public function addContent(string $key, $val)
4648
{
4749
$this->contents[$key] = $val;
4850
}
51+
52+
/**
53+
* toAjaxData
54+
*/
55+
public function toAjaxData(): array
56+
{
57+
return (array) $this->contents;
58+
}
4959
}

0 commit comments

Comments
 (0)