Skip to content

Commit

Permalink
Implement DisposableEmailAddressDisallowed exception
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhicks committed Dec 18, 2011
1 parent 56e4bb6 commit fe10428
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
@@ -0,0 +1,14 @@
<?php
namespace MantisBT\Exception\Email;
use MantisBT\Exception\ExceptionAbstract;

require_api('lang_api.php');

class DisposableEmailAddressDisallowed extends ExceptionAbstract {
public function __construct($invalidEmailAddress) {
$errorMessage = lang_get(ERROR_EMAIL_DISPOSABLE, null, false);
$errorMessage = sprintf($errorMessage, $invalidEmailAddress);
parent::__construct(ERROR_EMAIL_DISPOSABLE, $errorMessage, null);
$this->responseCode = 400;
}
}
3 changes: 2 additions & 1 deletion application/core/email_api.php
Expand Up @@ -48,6 +48,7 @@
* @uses utility_api.php
*/

use MantisBT\Exception\Email\DisposableEmailAddressDisallowed;
use MantisBT\Exception\Email\EmailAddressInvalid;
use MantisBT\Exception\Issue\Relationship\RelationshipNotFound;

Expand Down Expand Up @@ -182,7 +183,7 @@ function email_is_disposable( $p_email ) {
*/
function email_ensure_not_disposable( $p_email ) {
if( email_is_disposable( $p_email ) ) {
trigger_error( ERROR_EMAIL_DISPOSABLE, ERROR );
throw new DisposableEmailAddressDisallowed( $p_email );
}
}

Expand Down

0 comments on commit fe10428

Please sign in to comment.