Skip to content

Commit d36b84d

Browse files
committed
feat(exceptions): add NetworkException for connectivity failures
Signed-off-by: Vitor Mattos <vitor@php.rio>
1 parent 0f869ad commit d36b84d

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

src/Exception/NetworkException.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
// SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
4+
// SPDX-License-Identifier: AGPL-3.0-or-later
5+
6+
declare(strict_types=1);
7+
8+
namespace LibreCodeCoop\NfsePHP\Exception;
9+
10+
/**
11+
* Thrown when a network-level failure prevents communication with the gateway,
12+
* or when the gateway returns an unparseable response.
13+
*/
14+
class NetworkException extends NfseException
15+
{
16+
public function __construct(
17+
string $message,
18+
public readonly NfseErrorCode $errorCode = NfseErrorCode::NetworkFailure,
19+
?\Throwable $previous = null,
20+
) {
21+
parent::__construct($message, 0, $previous);
22+
}
23+
}

0 commit comments

Comments
 (0)