Could you namespace your exceptions module?

e.g.

module MySlice
  module Exceptions
    ...
  end
end

Tooky

On Tue, Mar 10, 2009 at 9:32 PM, Philippe Rathe <[email protected]> wrote:
>
> Hello,
>
> In my slice I'm including a file from lib/myslice_name.rb.
>
> There it is the file:
> #######################################
> module Exceptions
>  class InvalidForm < StandardError; end
>  class InvalidId < StandardError; end
> end
> #######################################
>
> So I can raise and rescue custom exceptions in my controller.
>
> It runs as expected when I start my slice with the slice command.
>
> But when this slice is included in my master application there is a
> conflict within app/controllers/exceptions.rb.
> The reason is because  exceptions is define as a module in my slice
> and as a class in my master application.
>
> There is app/controllers/exceptions.rb:
> ##############################################
> class Exceptions < Merb::Controller
>  # handle NotFound exceptions (404)
>  def not_found
>    render :format => :html
>  end
>
>  # handle NotAcceptable exceptions (406)
>  def not_acceptable
>    render :format => :html
>  end
> end
> ##############################################
>
> How should I be able to use custom exceptions within my slice without
> creating conflict when run within my master application?
>
> Thanks for helping
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to