mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-30 04:33:54 -06:00
Catch decrypt exceptions.
This commit is contained in:
parent
3d58fbebec
commit
cbe3fb73a8
@ -12,6 +12,8 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Crypt;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
@ -48,7 +50,11 @@ class Preference extends Model
|
||||
*/
|
||||
public function getDataAttribute($value)
|
||||
{
|
||||
$data = Crypt::decrypt($value);
|
||||
try {
|
||||
$data = Crypt::decrypt($value);
|
||||
} catch (DecryptException $e) {
|
||||
throw new FireflyException('Could not decrypt preference #' . $this->id . '.');
|
||||
}
|
||||
|
||||
return json_decode($data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user