---
title: "Local and Dispatch Exceptions"
url: https://docs.zeroc.com/ice/3.8/runtime/local-and-dispatch-exceptions
language: php
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# Local and Dispatch Exceptions

Programming language: PHP. Other languages: [C++](https://docs.zeroc.com/ice/3.8/runtime/local-and-dispatch-exceptions/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/runtime/local-and-dispatch-exceptions/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/runtime/local-and-dispatch-exceptions/java.md), [JavaScript](https://docs.zeroc.com/ice/3.8/runtime/local-and-dispatch-exceptions/js.md), [MATLAB](https://docs.zeroc.com/ice/3.8/runtime/local-and-dispatch-exceptions/matlab.md), [Python](https://docs.zeroc.com/ice/3.8/runtime/local-and-dispatch-exceptions/python.md), [Ruby](https://docs.zeroc.com/ice/3.8/runtime/local-and-dispatch-exceptions/ruby.md), [Swift](https://docs.zeroc.com/ice/3.8/runtime/local-and-dispatch-exceptions/swift.md).

## Local Exceptions

The Ice runtime reports errors by throwing *local exceptions*, which derive from [LocalException](https://code.zeroc.com/ice/3.8/api/php/classes/Ice-LocalException.html): for example, when it cannot establish a connection or when an invocation times out. Some Ice APIs also throw standard exceptions, such as `std::invalid_argument` in C++ or `IllegalArgumentException` in Java.

The exceptions you define in Slice are [user exceptions](https://docs.zeroc.com/ice/3.8/slice/exceptions/php.md). A user exception is an error result of an operation, which you receive only from a twoway invocation. In every language mapping, the class mapped from a Slice exception derives from [UserException](https://code.zeroc.com/ice/3.8/api/php/classes/Ice-UserException.html).

## Dispatch Exceptions

A *dispatch exception* is a local exception that reports the failure of the dispatch of a twoway request, such as a request for an Ice object that the object adapter does not host. The object adapter reports this failure with the [reply status](https://docs.zeroc.com/ice/3.8/protocol/protocol-messages/php.md#reply-message-body) of its reply message, and Ice throws the corresponding dispatch exception in the caller.

Dispatch exceptions derive from [DispatchException](https://code.zeroc.com/ice/3.8/api/php/classes/Ice-DispatchException.html), whose `replyStatus` field holds the reply status. For the reply statuses `ObjectNotExist` through `UnknownException`, Ice throws the exception class named after the reply status; for the other reply statuses, such as `InvalidData`, `Unauthorized`, and `NotSupported`, it throws a `DispatchException`.

[ObjectNotExistException](https://code.zeroc.com/ice/3.8/api/php/classes/Ice-ObjectNotExistException.html), [FacetNotExistException](https://code.zeroc.com/ice/3.8/api/php/classes/Ice-FacetNotExistException.html), and [OperationNotExistException](https://code.zeroc.com/ice/3.8/api/php/classes/Ice-OperationNotExistException.html) derive from [RequestFailedException](https://code.zeroc.com/ice/3.8/api/php/classes/Ice-RequestFailedException.html), which carries the identity, facet, and operation of the request. [UnknownLocalException](https://code.zeroc.com/ice/3.8/api/php/classes/Ice-UnknownLocalException.html) and [UnknownUserException](https://code.zeroc.com/ice/3.8/api/php/classes/Ice-UnknownUserException.html) derive from [UnknownException](https://code.zeroc.com/ice/3.8/api/php/classes/Ice-UnknownException.html).

A servant can throw a dispatch exception, which the caller receives. When a servant throws another local exception, the caller receives an `UnknownLocalException`, and for an exception that is neither a local exception nor a user exception, an `UnknownException`. Ice throws `UnknownUserException` locally, in the caller, when a reply carries a user exception that is not in the exception specification of the operation.

## See Also

- [User Exceptions](https://docs.zeroc.com/ice/3.8/slice/exceptions/php.md)
- [Protocol Messages](https://docs.zeroc.com/ice/3.8/protocol/protocol-messages/php.md)
