obfuscurity / descartes

Introspective dashboard for Graphite
MIT License
502 stars 65 forks source link

Better handling of GraphDashboardRelation dupes #115

Closed obfuscurity closed 11 years ago

obfuscurity commented 11 years ago

When the user attempts to add a duplicate graph id to a dashboard, the constraint violation gets passed up as a 500 error to the console:

Sequel::DatabaseError: PG::Error: ERROR:  duplicate key value violates unique constraint "graph_dashboard_relations_graph_id_dashboard_id_key"
DETAIL:  Key (graph_id, dashboard_id)=(86, 21) already exists.

Instead, we should catch the exception, skip the offending graph, and return a visible warning to the user.

obfuscurity commented 11 years ago

Better idea... simply catch the exception and redirect the user to the desired dashboard. Win-win-win.