# Rescue CookieOverflow

**URL:** <https://www.ruby-forum.com/t/rescue-cookieoverflow/167082>\
**Category:** Rails\
**Created:** [May 3, 2009, 1:33pm UTC](https://www.ruby-forum.com/t/rescue-cookieoverflow/167082 "2009-05-03T13:33:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joopp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3da27b/32.png) [@joopp](https://www.ruby-forum.com/u/joopp)\
**Post date:** [May 3, 2009, 1:33pm UTC](https://www.ruby-forum.com/t/rescue-cookieoverflow/167082/1 "2009-05-03T13:33:56Z")

</div>

Hi,

I’m trying to rescue from a  
ActionController::Session::CookieStore::CookieOverflow error… however  
this doesn’t work:

def some\_controller\_action  
begin  
session[:too\_much] = ‘toomuchinfotostore’\*4000  
rescue CookieOverflow  
render :text =\> ‘too much info’  
end  
render :text =\> ‘whoepsie’  
end

I tried rescue’ing other errors… but nothing seems to work :S

---

<div class="post-metadata">

**Author:** ![joopp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3da27b/32.png) [@joopp](https://www.ruby-forum.com/u/joopp)\
**Post date:** [May 3, 2009, 4:46pm UTC](https://www.ruby-forum.com/t/rescue-cookieoverflow/167082/2 "2009-05-03T16:46:10Z")

</div>

On May 3, 12:33 pm, “Joost H.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> ```
> render :text => 'too much info'
> 
> ```
> 
> end  
> render :text =\> ‘whoepsie’  
> end
> 
> I tried rescue’ing other errors… but nothing seems to work :S

I think the problem might be that the error is only raised at the  
point that rails tries to close out the session, which is after your  
action returns. You may have better luck with rescue\_from.

Fred

---

<div class="post-metadata">

**Author:** ![joopp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3da27b/32.png) [@joopp](https://www.ruby-forum.com/u/joopp)\
**Post date:** [May 3, 2009, 6:01pm UTC](https://www.ruby-forum.com/t/rescue-cookieoverflow/167082/3 "2009-05-03T18:01:07Z")

</div>

Yep… thanks. The error is thrown later… so you can only rescue it  
there or something… I’m now figuring out how to check cookie size  
inside an action. Any ideas?
