Completed
Push — 7.5 ( 2e04c6...91b0a7 )
by
unknown
18:03
created

DatabaseException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A wrap() 0 7 1
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace eZ\Publish\Core\Base\Exceptions;
10
11
use RuntimeException;
12
use Throwable;
13
14
/**
15
 * An exception that is thrown when the database encounters an error.
16
 */
17
final class DatabaseException extends RuntimeException
18
{
19
    public const DEFAULT_MESSAGE = 'Database error';
20
21
    public static function wrap(
22
        Throwable $previous,
23
        string $message = self::DEFAULT_MESSAGE,
24
        int $code = 0
25
    ): self {
26
        return new self($message, $code, $previous);
27
    }
28
}
29