Skip to content

Commit d1d92ce

Browse files
committed
refactor: refactored abstract Coder
1 parent 9b13b5f commit d1d92ce

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/Coder/Coder.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ public function encode(string $decoded): string
1212
{
1313
try {
1414
return $this->doEncode($decoded);
15+
} catch (Exception\CoderCouldNotEncodeData $exception) {
16+
throw $exception;
1517
} catch (Throwable $reason) {
16-
if ($reason instanceof Exception\CoderCouldNotEncodeData) {
17-
throw $reason;
18-
}
1918
throw new Exception\CoderCouldNotEncodeData(__METHOD__, $decoded, $reason);
2019
}
2120
}
@@ -24,10 +23,9 @@ public function decode(string $encoded): string
2423
{
2524
try {
2625
return $this->doDecode($encoded);
26+
} catch (Exception\CoderCouldNotDecodeData $exception) {
27+
throw $exception;
2728
} catch (Throwable $reason) {
28-
if ($reason instanceof Exception\CoderCouldNotDecodeData) {
29-
throw $reason;
30-
}
3129
throw new Exception\CoderCouldNotDecodeData(__METHOD__, $encoded, $reason);
3230
}
3331
}

0 commit comments

Comments
 (0)