- Removed hard-coded configs
This commit is contained in:
1 parent
a7dcdf4ee7
commit
bec3c36657
7 files changed
+80
-83
No files matched your search
@@ -18,6 +18,12 @@ class EmailConfiguration
|
||||
|
||||
public $smtpUseTLS = false;
|
||||
|
||||
public $toAddress = "";
|
||||
|
||||
public $fromAddress = "";
|
||||
|
||||
public $fromName = "";
|
||||
|
||||
public function __construct($type = self::AUTH_TYPE_SMTP)
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
@@ -2,19 +2,11 @@
|
||||
|
||||
namespace TheBugs;
|
||||
|
||||
use Psr\Http\Message\ResponseFactoryInterface,
|
||||
Psr\Container\ContainerInterface,
|
||||
Psr\Http\Message\ResponseInterface,
|
||||
use Psr\Http\Message\ResponseInterface,
|
||||
Psr\Http\Message\ServerRequestInterface,
|
||||
Psr\Http\Server\MiddlewareInterface,
|
||||
Psr\Http\Server\RequestHandlerInterface;
|
||||
|
||||
use Zend\Diactoros\Response,
|
||||
Zend\Diactoros\ServerRequest,
|
||||
Zend\Diactoros\Stream,
|
||||
Zend\Diactoros\Uri;
|
||||
|
||||
|
||||
class EmailErrorMiddleware implements MiddlewareInterface
|
||||
{
|
||||
protected /* EmailConfiguration */ $emailConfiguration;
|
||||
@@ -35,9 +27,8 @@ class EmailErrorMiddleware implements MiddlewareInterface
|
||||
$response = $handler->handle($request);
|
||||
|
||||
if ( $response->getStatusCode() === 500 ) {
|
||||
|
||||
$this->mailer->setTo('dave.mcnicoll@cslsj.qc.ca');
|
||||
$this->mailer->setFrom(['test@johndoe.com' => 'John Doe']);
|
||||
$this->mailer->setTo($this->emailConfiguration->toAddress);
|
||||
$this->mailer->setFrom([$this->emailConfiguration->fromAddress => $this->emailConfiguration->fromName]);
|
||||
|
||||
$bugReport = $response->getBody()->__toString();
|
||||
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace TheBugs\Exception;
|
||||
|
||||
class JavascriptException extends \Exception {
|
||||
|
||||
protected $url;
|
||||
|
||||
protected $stacktrace;
|
||||
|
||||
public function __construct(string $message, int $code, Exception $previous = null, string $file, int $line, string $url, array $trace)
|
||||
{
|
||||
$this->message = $message;
|
||||
$this->code = $code;
|
||||
$this->previous = $previous;
|
||||
$this->file = $file;
|
||||
$this->line = $line;
|
||||
$this->url = $url;
|
||||
$this->stacktrace = $trace;
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
return __CLASS__ . ": [{$this->url}:{$this->code}]: {$this->message}\n" . json_encode($this->stacktrace);
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
namespace TheBugs\Exception;
|
||||
|
||||
class JavascriptException extends \Exception {
|
||||
|
||||
protected $url;
|
||||
|
||||
protected $stacktrace;
|
||||
|
||||
public function __construct(string $message, int $code, Exception $previous = null, string $file, int $line, string $url, array $trace)
|
||||
{
|
||||
$this->message = $message;
|
||||
$this->code = $code;
|
||||
$this->previous = $previous;
|
||||
$this->file = $file;
|
||||
$this->line = $line;
|
||||
$this->url = $url;
|
||||
$this->stacktrace = $trace;
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
return __CLASS__ . ": [{$this->url}:{$this->code}]: {$this->message}\n" . json_encode($this->stacktrace);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user