When Session encounters an error, it calls die(). You will probably want to wrap your session logic in an eval block to trap these errors.