Skip to content

Commit

Permalink
Merge pull request #9 from kprovorov/master
Browse files Browse the repository at this point in the history
Add InvalidTokenException
  • Loading branch information
junaidnasir authored Jun 16, 2017
2 parents 4e9dcc0 + 2ca9fd6 commit 1ee6f25
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/Exceptions/InvalidTokenException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Junaidnasir\Larainvite\Exceptions;

use Exception;

class InvalidTokenException extends Exception
{
//
}
3 changes: 2 additions & 1 deletion src/LaraInvite.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use Carbon\Carbon;
use Illuminate\Support\Facades\Event;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Junaidnasir\Larainvite\Exceptions\InvalidTokenException;

/**
* Laravel Invitation class
Expand Down Expand Up @@ -206,7 +207,7 @@ private function getModelInstance($allowNew = true)
$this->instance = (new $model)->where('code', $this->code)->firstOrFail();
return $this;
} catch (ModelNotFoundException $e) {
throw new Exception("Invalid Token {$this->code}", 1);
throw new InvalidTokenException("Invalid Token {$this->code}", 401);
}
}

Expand Down

0 comments on commit 1ee6f25

Please sign in to comment.