You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get the error email.
Only when I add 'yii\web\HttpException:410'or 'yii\web\HttpException:*', for except the email wouldn't been sent.
When I use CallSubmissionException extends yii\base\UserException (and remove the status code from the exception throw) i could use this except 'app\components\exceptions\CallSubmissionException' and the email isn't sent which is correct.
But then the HTTP error which is returned to the browser is 500 instead of 410.
It is also 500 when I use exactly the code from the original HttpException.
class CallSubmissionException extends UserException
{
public $statusCode;
public function __construct($status, $message = null, $code = 0, \Exception $previous = null)
{
$this->statusCode = $status;
parent::__construct($message, $code, $previous);
}
public function getName()
{
if (isset(Response::$httpStatuses[$this->statusCode])) {
return Response::$httpStatuses[$this->statusCode];
}
return 'Error';
}
}
The email isn't set but the http error code is not the given one.
So i guess there is some handling of the HttpException for the http error code elsewhere.
So in order to return the correct http error code I must extend from HttpException.
But then i couldn't disable for a specific HttpException at one point but only by the error code.
Additional info
Q
A
Yii version
2.0.15.1
PHP version
7.1.4
Operating system
Windows 10
The text was updated successfully, but these errors were encountered:
What steps will reproduce the problem?
I have an EmailTarget and doesn't wanted to get the email of an extended HttpException.
My extended Exception:
My throw:
My EmailTarget config:
What is the expected result?
That the Error Email isn't sent.
What do you get instead?
I get the error email.
Only when I add
'yii\web\HttpException:410'
or'yii\web\HttpException:*',
for except the email wouldn't been sent.When I use
CallSubmissionException extends yii\base\UserException
(and remove the status code from the exception throw) i could use this except'app\components\exceptions\CallSubmissionException'
and the email isn't sent which is correct.But then the HTTP error which is returned to the browser is 500 instead of 410.
It is also 500 when I use exactly the code from the original HttpException.
class CallSubmissionException extends UserException
{
public $statusCode;
public function __construct($status, $message = null, $code = 0, \Exception $previous = null)
{
$this->statusCode = $status;
parent::__construct($message, $code, $previous);
}
}
The email isn't set but the http error code is not the given one.
So i guess there is some handling of the HttpException for the http error code elsewhere.
So in order to return the correct http error code I must extend from HttpException.
But then i couldn't disable for a specific HttpException at one point but only by the error code.
Additional info
The text was updated successfully, but these errors were encountered: