Skip to main content

Overview

Namespace: FQL\Exception All FiQueLa exceptions extend either a standard PHP exception class or FQL\Exception\Exception (which itself extends \Exception). You can catch them by specific type or use the base classes to catch groups.

Base exception

Exception

Root base class for most FiQueLa-specific exceptions. Catch this to handle any FiQueLa error that is not a logic error or a standard PHP SPL exception.

File and I/O exceptions

FileNotFoundException

Thrown when the file passed to fromFile(), open(), or any stream factory cannot be found on the filesystem or is not readable. Thrown by: Stream\Provider::fromFile(), Query\Provider::fromFile(), Csv::open(), and all other stream open() methods.

FileAlreadyExistsException

Thrown when attempting to create or write to a file that already exists and overwriting is not permitted.

UnableOpenFileException

Thrown when a file is found but cannot be opened for reading (e.g. due to OS-level permissions or a corrupted file handle).

FileQueryException

Thrown when a FileQuery string (the URI-style path used by fromFileQuery() and into()) is malformed or references a missing target file. Thrown by: ResultsProvider::into(), Query\Provider::fromFileQuery().

Format and argument exceptions

InvalidFormatException

Thrown when the file extension cannot be mapped to a known format, or when fromString() is called with an unsupported format. Also thrown for invalid CSV parameters (bad delimiter, unsupported encoding, etc.). Thrown by: Format::fromExtension(), Stream\Provider::fromFile(), Stream\Provider::fromString(), Format::fromString().

InvalidArgumentException

Base class for all argument-validation exceptions in FiQueLa. Thrown when a method receives a value that is out of range or of the wrong type — for example, passing an unsupported operator string to Operator::fromOrFail(), or providing a non-scalar BETWEEN range.

UnexpectedValueException

Thrown when a value does not match the expected domain — for example, when trying to override already-set WHERE or HAVING conditions.

Query construction exceptions

These exceptions are thrown during query building (before execute() is called).

QueryLogicException

Thrown when mutually exclusive query clauses are combined — specifically:
  • Using DISTINCT together with GROUP BY.
  • Using GROUP BY together with DISTINCT.
  • Using UNION with mismatched column counts between the main query and a union query.

SelectException

Prefixes its message with SELECT:. Thrown when:
  • A field is selected more than once with select().
  • A modulo() division produces an unexpected value.

AliasException

Prefixes its message with AS:. Thrown when as() is called with:
  • An empty alias string.
  • An alias that is already used.
  • No preceding selected field to alias.
  • A field that was already aliased.

JoinException

Prefixes its message with JOIN:. Thrown when:
  • A join is added with an empty alias.
  • on() is called without a preceding join.

OrderByException

Prefixes its message with ORDER BY:. Thrown when:
  • The same field is added to orderBy() twice.
  • asc() or desc() is called when no ordering has been set.

SortException

Prefixes its message with ORDER BY:. Thrown by the sort execution phase when an unexpected error occurs while sorting the result set.

CaseException

Prefixes its message with CASE:. Thrown when the CASE expression builder methods are called out of order:
  • whenCase() without a preceding case().
  • elseCase() without a preceding case() or whenCase().
  • elseCase() called twice.
  • endCase() without a preceding case().

Runtime exceptions

NotImplementedException

Thrown when a method or feature is not yet implemented. The constructor accepts a callable and generates a descriptive message like "Static method FQL\Stream\Csv::string not implemented yet." Currently thrown by Csv::string() (creating a CSV stream from a string is not supported).

SQL parser and function registry exceptions

These exceptions were introduced in FiQueLa 3.0 alongside the new SQL pipeline and FunctionRegistry.

ParseException

Thrown by Sql\Provider::compile(), parseExpression(), parseCondition(), and Query\Provider::fql() when an FQL string is syntactically invalid. The exception carries the offending token and its line/column information so callers can surface precise error locations.

UnknownFunctionException

Thrown when a query references a function name that is not registered in the global FunctionRegistry. Register the function with FunctionRegistry::register(MyFn::class) at bootstrap before running the query.

FunctionRegistrationException

Thrown by FunctionRegistry::register(), override(), unregister(), and loadConfig() when a registration cannot be completed — for example, registering a class that does not implement ScalarFunction or AggregateFunction, or attempting to register a name that already exists without using override(). See Custom functions for the full registry API.

Exception hierarchy