{"action":"created","comment":{"url":"https://api.github.com/repos/operable/cog/pulls/comments/79451396","id":79451396,"diff_hunk":"@@ -76,27 +76,34 @@ defmodule Cog.V1.BundleDynamicConfigController do\n       nil ->\n         not_found(conn, \"Bundle #{bundle_id} not found\")\n       bundle ->\n-        case Bundles.create_dynamic_config_for_bundle(bundle, params) do\n-          {:ok, dyn_config} ->\n-            location = case Map.get(params, \"layer\") do\n-                         \"base\" ->\n-                           Helpers.bundle_dynamic_config_path(conn, :show_layer,\n-                                                              dyn_config.bundle_id,\n-                                                              dyn_config.layer, %{})\n-                         _ ->\n-                           Helpers.bundle_dynamic_config_path(conn, :show_layer,\n-                                                              dyn_config.bundle_id,\n-                                                              dyn_config.layer,\n-                                                              dyn_config.name, %{})\n-                       end\n-            conn\n-            |> put_status(:created)\n-            |> put_resp_header(\"location\", location)\n-            |> render(\"show.json\", dynamic_config: dyn_config)\n-          {:error, changeset} ->\n+        try do\n+          case Bundles.create_dynamic_config_for_bundle!(bundle, params) do\n+            {:ok, dyn_config} ->\n+              location = case Map.get(params, \"layer\") do\n+                           \"base\" ->\n+                             Helpers.bundle_dynamic_config_path(conn, :show_layer,\n+                               dyn_config.bundle_id,\n+                               dyn_config.layer, %{})\n+                           _ ->\n+                             Helpers.bundle_dynamic_config_path(conn, :show_layer,\n+                               dyn_config.bundle_id,\n+                               dyn_config.layer,\n+                               dyn_config.name, %{})\n+                         end\n+              conn\n+              |> put_status(:created)\n+              |> put_resp_header(\"location\", location)\n+              |> render(\"show.json\", dynamic_config: dyn_config)\n+            {:error, changeset} ->\n+              conn\n+              |> put_status(:unprocessable_entity)\n+              |> render(Cog.ChangesetView, \"error.json\", changeset: changeset)\n+          end\n+        rescue","path":"web/controllers/v1/bundle_dynamic_config_controller.ex","position":45,"original_position":45,"commit_id":"5aaef506b5186812033f8b9b04bef06a232b1479","original_commit_id":"5aaef506b5186812033f8b9b04bef06a232b1479","user":{"login":"christophermaier","id":207178,"avatar_url":"https://avatars.githubusercontent.com/u/207178?v=3","gravatar_id":"","url":"https://api.github.com/users/christophermaier","html_url":"https://github.com/christophermaier","followers_url":"https://api.github.com/users/christophermaier/followers","following_url":"https://api.github.com/users/christophermaier/following{/other_user}","gists_url":"https://api.github.com/users/christophermaier/gists{/gist_id}","starred_url":"https://api.github.com/users/christophermaier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christophermaier/subscriptions","organizations_url":"https://api.github.com/users/christophermaier/orgs","repos_url":"https://api.github.com/users/christophermaier/repos","events_url":"https://api.github.com/users/christophermaier/events{/privacy}","received_events_url":"https://api.github.com/users/christophermaier/received_events","type":"User","site_admin":false},"body":"This is good, but I'm curious if Phoenix's built-in exception handling will handle this. If it can't out of the box, then I suspect there's just a small bit of configuration we'd need to set in order for it to work.\r\n\r\nThat being said, I'm certain this is not the only place in the API where we're doing this. It may be worth leaving this as is, and then following up to make a more principled pass through the rest of the code to fix things up. ","created_at":"2016-09-19T18:01:01Z","updated_at":"2016-09-19T18:01:11Z","html_url":"https://github.com/operable/cog/pull/962#discussion_r79451396","pull_request_url":"https://api.github.com/repos/operable/cog/pulls/962","_links":{"self":{"href":"https://api.github.com/repos/operable/cog/pulls/comments/79451396"},"html":{"href":"https://github.com/operable/cog/pull/962#discussion_r79451396"},"pull_request":{"href":"https://api.github.com/repos/operable/cog/pulls/962"}}},"pull_request":{"url":"https://api.github.com/repos/operable/cog/pulls/962","id":85839988,"html_url":"https://github.com/operable/cog/pull/962","diff_url":"https://github.com/operable/cog/pull/962.diff","patch_url":"https://github.com/operable/cog/pull/962.patch","issue_url":"https://api.github.com/repos/operable/cog/issues/962","number":962,"state":"open","locked":false,"title":"Improve dynamic config err msg","user":{"login":"kevsmith","id":13558,"avatar_url":"https://avatars.githubusercontent.com/u/13558?v=3","gravatar_id":"","url":"https://api.github.com/users/kevsmith","html_url":"https://github.com/kevsmith","followers_url":"https://api.github.com/users/kevsmith/followers","following_url":"https://api.github.com/users/kevsmith/following{/other_user}","gists_url":"https://api.github.com/users/kevsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/kevsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevsmith/subscriptions","organizations_url":"https://api.github.com/users/kevsmith/orgs","repos_url":"https://api.github.com/users/kevsmith/repos","events_url":"https://api.github.com/users/kevsmith/events{/privacy}","received_events_url":"https://api.github.com/users/kevsmith/received_events","type":"User","site_admin":false},"body":"Catch Ecto exception and use Cog.ChangesetView to render it.\r\n\r\nFixes #867","created_at":"2016-09-19T17:57:07Z","updated_at":"2016-09-19T18:01:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6176910229a73476525c736ea694e441fcfc9081","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/operable/cog/pulls/962/commits","review_comments_url":"https://api.github.com/repos/operable/cog/pulls/962/comments","review_comment_url":"https://api.github.com/repos/operable/cog/pulls/comments{/number}","comments_url":"https://api.github.com/repos/operable/cog/issues/962/comments","statuses_url":"https://api.github.com/repos/operable/cog/statuses/5aaef506b5186812033f8b9b04bef06a232b1479","head":{"label":"operable:kevsmith/better-dynamic-config-error","ref":"kevsmith/better-dynamic-config-error","sha":"5aaef506b5186812033f8b9b04bef06a232b1479","user":{"login":"operable","id":6070463,"avatar_url":"https://avatars.githubusercontent.com/u/6070463?v=3","gravatar_id":"","url":"https://api.github.com/users/operable","html_url":"https://github.com/operable","followers_url":"https://api.github.com/users/operable/followers","following_url":"https://api.github.com/users/operable/following{/other_user}","gists_url":"https://api.github.com/users/operable/gists{/gist_id}","starred_url":"https://api.github.com/users/operable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/operable/subscriptions","organizations_url":"https://api.github.com/users/operable/orgs","repos_url":"https://api.github.com/users/operable/repos","events_url":"https://api.github.com/users/operable/events{/privacy}","received_events_url":"https://api.github.com/users/operable/received_events","type":"Organization","site_admin":false},"repo":{"id":49292670,"name":"cog","full_name":"operable/cog","owner":{"login":"operable","id":6070463,"avatar_url":"https://avatars.githubusercontent.com/u/6070463?v=3","gravatar_id":"","url":"https://api.github.com/users/operable","html_url":"https://github.com/operable","followers_url":"https://api.github.com/users/operable/followers","following_url":"https://api.github.com/users/operable/following{/other_user}","gists_url":"https://api.github.com/users/operable/gists{/gist_id}","starred_url":"https://api.github.com/users/operable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/operable/subscriptions","organizations_url":"https://api.github.com/users/operable/orgs","repos_url":"https://api.github.com/users/operable/repos","events_url":"https://api.github.com/users/operable/events{/privacy}","received_events_url":"https://api.github.com/users/operable/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/operable/cog","description":"Bringing the power of the command line to chat","fork":false,"url":"https://api.github.com/repos/operable/cog","forks_url":"https://api.github.com/repos/operable/cog/forks","keys_url":"https://api.github.com/repos/operable/cog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/operable/cog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/operable/cog/teams","hooks_url":"https://api.github.com/repos/operable/cog/hooks","issue_events_url":"https://api.github.com/repos/operable/cog/issues/events{/number}","events_url":"https://api.github.com/repos/operable/cog/events","assignees_url":"https://api.github.com/repos/operable/cog/assignees{/user}","branches_url":"https://api.github.com/repos/operable/cog/branches{/branch}","tags_url":"https://api.github.com/repos/operable/cog/tags","blobs_url":"https://api.github.com/repos/operable/cog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/operable/cog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/operable/cog/git/refs{/sha}","trees_url":"https://api.github.com/repos/operable/cog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/operable/cog/statuses/{sha}","languages_url":"https://api.github.com/repos/operable/cog/languages","stargazers_url":"https://api.github.com/repos/operable/cog/stargazers","contributors_url":"https://api.github.com/repos/operable/cog/contributors","subscribers_url":"https://api.github.com/repos/operable/cog/subscribers","subscription_url":"https://api.github.com/repos/operable/cog/subscription","commits_url":"https://api.github.com/repos/operable/cog/commits{/sha}","git_commits_url":"https://api.github.com/repos/operable/cog/git/commits{/sha}","comments_url":"https://api.github.com/repos/operable/cog/comments{/number}","issue_comment_url":"https://api.github.com/repos/operable/cog/issues/comments{/number}","contents_url":"https://api.github.com/repos/operable/cog/contents/{+path}","compare_url":"https://api.github.com/repos/operable/cog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/operable/cog/merges","archive_url":"https://api.github.com/repos/operable/cog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/operable/cog/downloads","issues_url":"https://api.github.com/repos/operable/cog/issues{/number}","pulls_url":"https://api.github.com/repos/operable/cog/pulls{/number}","milestones_url":"https://api.github.com/repos/operable/cog/milestones{/number}","notifications_url":"https://api.github.com/repos/operable/cog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/operable/cog/labels{/name}","releases_url":"https://api.github.com/repos/operable/cog/releases{/id}","deployments_url":"https://api.github.com/repos/operable/cog/deployments","created_at":"2016-01-08T19:45:06Z","updated_at":"2016-09-19T16:19:34Z","pushed_at":"2016-09-19T17:57:07Z","git_url":"git://github.com/operable/cog.git","ssh_url":"git@github.com:operable/cog.git","clone_url":"https://github.com/operable/cog.git","svn_url":"https://github.com/operable/cog","homepage":"http://operable.io","size":2667,"stargazers_count":481,"watchers_count":481,"language":"Elixir","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":110,"forks":33,"open_issues":110,"watchers":481,"default_branch":"master"}},"base":{"label":"operable:master","ref":"master","sha":"09b5c15a2c97d0a97914ddc50823c6a27f395f45","user":{"login":"operable","id":6070463,"avatar_url":"https://avatars.githubusercontent.com/u/6070463?v=3","gravatar_id":"","url":"https://api.github.com/users/operable","html_url":"https://github.com/operable","followers_url":"https://api.github.com/users/operable/followers","following_url":"https://api.github.com/users/operable/following{/other_user}","gists_url":"https://api.github.com/users/operable/gists{/gist_id}","starred_url":"https://api.github.com/users/operable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/operable/subscriptions","organizations_url":"https://api.github.com/users/operable/orgs","repos_url":"https://api.github.com/users/operable/repos","events_url":"https://api.github.com/users/operable/events{/privacy}","received_events_url":"https://api.github.com/users/operable/received_events","type":"Organization","site_admin":false},"repo":{"id":49292670,"name":"cog","full_name":"operable/cog","owner":{"login":"operable","id":6070463,"avatar_url":"https://avatars.githubusercontent.com/u/6070463?v=3","gravatar_id":"","url":"https://api.github.com/users/operable","html_url":"https://github.com/operable","followers_url":"https://api.github.com/users/operable/followers","following_url":"https://api.github.com/users/operable/following{/other_user}","gists_url":"https://api.github.com/users/operable/gists{/gist_id}","starred_url":"https://api.github.com/users/operable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/operable/subscriptions","organizations_url":"https://api.github.com/users/operable/orgs","repos_url":"https://api.github.com/users/operable/repos","events_url":"https://api.github.com/users/operable/events{/privacy}","received_events_url":"https://api.github.com/users/operable/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/operable/cog","description":"Bringing the power of the command line to chat","fork":false,"url":"https://api.github.com/repos/operable/cog","forks_url":"https://api.github.com/repos/operable/cog/forks","keys_url":"https://api.github.com/repos/operable/cog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/operable/cog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/operable/cog/teams","hooks_url":"https://api.github.com/repos/operable/cog/hooks","issue_events_url":"https://api.github.com/repos/operable/cog/issues/events{/number}","events_url":"https://api.github.com/repos/operable/cog/events","assignees_url":"https://api.github.com/repos/operable/cog/assignees{/user}","branches_url":"https://api.github.com/repos/operable/cog/branches{/branch}","tags_url":"https://api.github.com/repos/operable/cog/tags","blobs_url":"https://api.github.com/repos/operable/cog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/operable/cog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/operable/cog/git/refs{/sha}","trees_url":"https://api.github.com/repos/operable/cog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/operable/cog/statuses/{sha}","languages_url":"https://api.github.com/repos/operable/cog/languages","stargazers_url":"https://api.github.com/repos/operable/cog/stargazers","contributors_url":"https://api.github.com/repos/operable/cog/contributors","subscribers_url":"https://api.github.com/repos/operable/cog/subscribers","subscription_url":"https://api.github.com/repos/operable/cog/subscription","commits_url":"https://api.github.com/repos/operable/cog/commits{/sha}","git_commits_url":"https://api.github.com/repos/operable/cog/git/commits{/sha}","comments_url":"https://api.github.com/repos/operable/cog/comments{/number}","issue_comment_url":"https://api.github.com/repos/operable/cog/issues/comments{/number}","contents_url":"https://api.github.com/repos/operable/cog/contents/{+path}","compare_url":"https://api.github.com/repos/operable/cog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/operable/cog/merges","archive_url":"https://api.github.com/repos/operable/cog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/operable/cog/downloads","issues_url":"https://api.github.com/repos/operable/cog/issues{/number}","pulls_url":"https://api.github.com/repos/operable/cog/pulls{/number}","milestones_url":"https://api.github.com/repos/operable/cog/milestones{/number}","notifications_url":"https://api.github.com/repos/operable/cog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/operable/cog/labels{/name}","releases_url":"https://api.github.com/repos/operable/cog/releases{/id}","deployments_url":"https://api.github.com/repos/operable/cog/deployments","created_at":"2016-01-08T19:45:06Z","updated_at":"2016-09-19T16:19:34Z","pushed_at":"2016-09-19T17:57:07Z","git_url":"git://github.com/operable/cog.git","ssh_url":"git@github.com:operable/cog.git","clone_url":"https://github.com/operable/cog.git","svn_url":"https://github.com/operable/cog","homepage":"http://operable.io","size":2667,"stargazers_count":481,"watchers_count":481,"language":"Elixir","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":110,"forks":33,"open_issues":110,"watchers":481,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/operable/cog/pulls/962"},"html":{"href":"https://github.com/operable/cog/pull/962"},"issue":{"href":"https://api.github.com/repos/operable/cog/issues/962"},"comments":{"href":"https://api.github.com/repos/operable/cog/issues/962/comments"},"review_comments":{"href":"https://api.github.com/repos/operable/cog/pulls/962/comments"},"review_comment":{"href":"https://api.github.com/repos/operable/cog/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/operable/cog/pulls/962/commits"},"statuses":{"href":"https://api.github.com/repos/operable/cog/statuses/5aaef506b5186812033f8b9b04bef06a232b1479"}}}}
{"actor":{"display_login":"christophermaier"}}