Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to whitelist exceptions #15

Closed
thousandsofthem opened this issue Jul 11, 2016 · 9 comments
Closed

Ability to whitelist exceptions #15

thousandsofthem opened this issue Jul 11, 2016 · 9 comments

Comments

@thousandsofthem
Copy link
Contributor

Would be really useful,
e.g.
Ecto.NoResultsError is totally legit exception that should not be tracked anyhow

@thousandsofthem
Copy link
Contributor Author

#16

@fazibear
Copy link
Owner

I think there is no legit execptions. Every exception will terminate process. I think when you code throws exceptions at runtime is really bad. It means that something happened that you don't expect, and you should take care of it, not hide.

With this feature you'll miss things that should never happened.

@thousandsofthem
Copy link
Contributor Author

I think there is no legit execptions.

My real usecase:
Phoenix, getting 404 on some random request (various bots love to do that)
e.g. GET /randomcrap -> Phoenix.Router.NoRouteError

What's the right solution?

usecase # 2: getting record by ID.
e.g.

 def show(conn, %{"photo_id" => photo_id}) do
    photo = Repo.get!(Photo, photo_id)
    ...

Code is clear and self-describing. if photo is not found - fail, show error. but i do not want to see similar errors in the error tracker (in many cases endusers can try random ids etc)

What's the right solution?

@joshuaswilcox
Copy link

I agree, I would like be able to ignore certain errors, esp 404s from bots

@fazibear
Copy link
Owner

I'm still not get it. Why you want to ignore exception instead of catch it and handle them ?

In case of 404 you can make your own beautiful not found page.
If you want to get data from data base, and expect that you won't find any items, user Repo.get instead of Repo.get! and process both cases.

Of course we can't implement that, but application should work without throwing exceptions, because this is exceptions and should not accurs. Will loog at this RP once again later.

@joshuaswilcox
Copy link

Because with a 404 page it still send the error since Elixir.Phoenix.Router.NoRouteError is raised

@fazibear
Copy link
Owner

What about catch_errors: true ?

@joshuaswilcox
Copy link

No that does not work either

@fazibear
Copy link
Owner

fazibear commented Nov 6, 2016

Merged!

@fazibear fazibear closed this as completed Nov 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants