# perldoc > CGI::Session::ErrorHandler

---
type: CommandReference
command: CGI::Session::ErrorHandler
mode: perldoc
section: ""
source: perldoc
---

## Quick Reference

- `set_error($message)` — Set error message, returns undef
- `errstr()` — Get last error message, returns empty string if none

## Name

`CGI::Session::ErrorHandler` — error handling routines for `CGI::Session`

## Synopsis

perl
require CGI::Session::ErrorHandler;
@ISA = qw( CGI::Session::ErrorHandler );

sub some_method {
    my $self = shift;
    unless ( $some_condition ) {
        return $self->set_error("some_method(): \$some_condition isn't met");
    }
}
## Description

Provides `set_error()` and `errstr()` methods for setting and accessing error messages from within `CGI::Session`'s components. Intended for driver developers to provide standard error handling routines.

## Methods

- `set_error($message)` — Implicitly defines `$pkg_name::errstr` and sets its value to `$message`. Return value is always undef.
- `errstr()` — Returns whatever value was set by the most recent call to `set_error()`. If no message has been set yet, returns the empty string so concatenation works without warnings.

## See Also

- [CGI::Session](https://metacpan.org/pod/CGI::Session) — licensing and support information