Skip to content

Commit a754b26

Browse files
authored
Catch correct exception when fields are missing during decryption
1 parent 1b8c316 commit a754b26

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Observers/ModelObserver.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Spatie\LaravelCipherSweet\Observers;
44

5-
use ErrorException;
5+
use ParagonIE\CipherSweet\Exception\EmptyFieldException;
66
use Spatie\LaravelCipherSweet\Contracts\CipherSweetEncrypted;
77

88
class ModelObserver
@@ -16,7 +16,7 @@ public function retrieved(CipherSweetEncrypted $model): void
1616
{
1717
try {
1818
$model->decryptRow();
19-
} catch (ErrorException) {
19+
} catch (EmptyFieldException) {
2020
// Not all fields are available to decrypt.
2121
}
2222
}

0 commit comments

Comments
 (0)