Skip to content

exceptions

Alexey Borzov edited this page Sep 18, 2017 · 1 revision

Exception classes

The package contains base exception interface \sad_spirit\pg_builder\Exception and several specialized exception classes that extend SPL Exception classes and implement this interface. Therefore all exceptions thrown in pg_builder can be caught with

try {
    // Do some query parsing and building
} catch (\sad_spirit\pg_builder\Exception $e) {
    // Handle exception
}

All exception classes belong to sad_spirit\pg_builder\exceptions namespace:

  • BadMethodCallException extends \BadMethodCallException - Namespaced version of SPL's BadMethodCallException. Thrown by Parser::__call() for unavailable methods.
  • InvalidArgumentException extends \InvalidArgumentException - Namespaced version of SPL's InvalidArgumentException.
  • RuntimeException extends \RuntimeException - Namespaced version of SPL's RuntimeException.
    • NotImplementedException extends RuntimeException - Thrown for not-quite-ready features
  • SyntaxException extends \DomainException - Thrown for parsing failures