# Give Feedback for an Error Condition in a Block

In general, Cognex recommends not throwing exceptions in a Task or Task, since it can affect performance. However, exceptions should still be thrown in case of an error.

An error is defined as something unexpected occurring during runtime, e.g. your input image is null, or something occurring that is not defined as a failed result, e.g. expecting a result at array index 0, but receiving an empty array, instead.

When you throw an exception in a Task block, e.g. checking for bad input values, the following occur:

- Suffer a performance hit.
- The exception will affect the Task.
- The Task will stop.
- The exception will be logged to the log files.
- The exception will be logged to the Output window (if it occurs while running in development mode).
- The OnError script will be run (which will contain the block name and an error message).
- In the Task Editor, the block in error will have a red circle (if it occurs while running in development mode).