-
-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Be more informative when credentials have not been found
- Loading branch information
1 parent
402dcc1
commit 63b74c1
Showing
3 changed files
with
40 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Kreait\Firebase\Exception; | ||
|
||
use Kreait\Firebase\Factory; | ||
use Throwable; | ||
|
||
class CredentialsNotFound extends LogicException | ||
{ | ||
/** | ||
* @var string[] | ||
*/ | ||
private $triedPaths; | ||
|
||
public function __construct($triedPaths, $message = '', $code = 0, Throwable $previous = null) | ||
{ | ||
$message = $message ?: sprintf( | ||
'No service account has been found. Tried [%s]. Please set the path to a valid service account credentials file with %s::%s()', | ||
implode(', ', $triedPaths), Factory::class, 'withCredentials($path)' | ||
); | ||
|
||
parent::__construct($message, $code, $previous); | ||
|
||
$this->triedPaths = $triedPaths; | ||
} | ||
|
||
/** | ||
* @return \string[] | ||
*/ | ||
public function getTriedPaths(): array | ||
{ | ||
return $this->triedPaths; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters