mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-23 05:54:55 +00:00
e92bda5373
- Fix handling of binary data and long strings - Simplify handling of socket connections - Fix coverage
26 lines
826 B
PHP
26 lines
826 B
PHP
<?php
|
|
/** @license MIT
|
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
|
* See LICENSE and AUTHORS files for details */
|
|
|
|
declare(strict_types=1);
|
|
namespace JKingWeb\Arsse\Db\MySQL;
|
|
|
|
use JKingWeb\Arsse\Db\Exception;
|
|
use JKingWeb\Arsse\Db\ExceptionInput;
|
|
use JKingWeb\Arsse\Db\ExceptionTimeout;
|
|
|
|
trait ExceptionBuilder {
|
|
public static function buildEngineException($code, string $msg): array {
|
|
switch ($code) {
|
|
case 1205:
|
|
return [ExceptionTimeout::class, 'general', $msg];
|
|
case 1364:
|
|
return [ExceptionInput::class, "engineConstraintViolation", $msg];
|
|
case 1366:
|
|
return [ExceptionInput::class, 'engineTypeViolation', $msg];
|
|
default:
|
|
return [Exception::class, 'engineErrorGeneral', $msg];
|
|
}
|
|
}
|
|
}
|