# Formatting a pretty page for 'raise' errors

**URL:** <https://www.ruby-forum.com/t/formatting-a-pretty-page-for-raise-errors/107764>\
**Category:** Rails\
**Created:** [June 26, 2007, 1:02am UTC](https://www.ruby-forum.com/t/formatting-a-pretty-page-for-raise-errors/107764 "2007-06-26T01:02:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@luke](https://www.ruby-forum.com/u/luke)\
**Post date:** [June 26, 2007, 1:02am UTC](https://www.ruby-forum.com/t/formatting-a-pretty-page-for-raise-errors/107764/1 "2007-06-26T01:02:58Z")

</div>

Hi,

I’m using the following code to handle an error

```
unless user_can_view_group
  raise "User does not have permission to view group'"
end

```

Which happily prevents users from viewing groups. But the error page  
is rather ugly, and I’d like to pass the raise string to a view which  
can give them a nicer looking error page. Is this possible?

Luke

---

<div class="post-metadata">

**Author:** ![luke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@luke](https://www.ruby-forum.com/u/luke)\
**Post date:** [June 26, 2007, 1:07am UTC](https://www.ruby-forum.com/t/formatting-a-pretty-page-for-raise-errors/107764/2 "2007-06-26T01:07:58Z")

</div>

On Jun 26, 2007, at 1:01 AM, luke wrote:

> ```
> unless user_can_view_group
> raise "User does not have permission to view group'"
> end
> 
> ```
> 
> Which happily prevents users from viewing groups. But the error page  
> is rather ugly, and I’d like to pass the raise string to a view which  
> can give them a nicer looking error page. Is this possible?

Instead of raising an exception you can handle that with a regular view:

unless user\_can\_view\_group  
@msg = “User does not have permission to view group”  
render :action =\> ‘generic\_message’  
end

– fxn
