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

Deleting a firmware signing key that has associations produces large error #23

Open
mobileoverlord opened this issue Aug 28, 2018 · 1 comment

Comments

@mobileoverlord
Copy link
Contributor

We need to capture constraint errors and present them in a pretty way.

Deleting remote signing key test
Unhandled error: {:error, {:error, %Jason.DecodeError{data: "# Ecto.ConstraintError at DELETE /orgs/nerveshub/keys/test\n\nException:\n\n    ** (Ecto.ConstraintError) constraint error when attempting to delete struct:\n    \n        * foreign_key: firmwares_tenant_key_id_fkey\n    \n    If you would like to convert this constraint into an error, please\n    call foreign_key_constraint/3 in your changeset and define the proper\n    constraint name. The changeset has not defined any constraint.\n    \n        (ecto) lib/ecto/repo/schema.ex:574: anonymous fn/4 in Ecto.Repo.Schema.constraints_to_errors/3\n        (elixir) lib/enum.ex:1314: Enum.\"-map/2-lists^map/1-0-\"/2\n        (ecto) lib/ecto/repo/schema.ex:559: Ecto.Repo.Schema.constraints_to_errors/3\n        (ecto) lib/ecto/repo/schema.ex:386: anonymous fn/9 in Ecto.Repo.Schema.do_delete/4\n        (ecto) lib/ecto/repo/schema.ex:774: anonymous fn/3 in Ecto.Repo.Schema.wrap_in_transaction/6\n        (ecto) lib/ecto/adapters/sql.ex:576: anonymous fn/3 in Ecto.Adapters.SQL.do_transaction/3\n        (db_connection) lib/db_connection.ex:1283: DBConnection.transaction_run/4\n        (db_connection) lib/db_connection.ex:1207: DBConnection.run_begin/3\n        (db_connection) lib/db_connection.ex:798: DBConnection.transaction/3\n        (nerves_hub_api) lib/nerves_hub_api_web/controllers/key_controller.ex:34: NervesHubAPIWeb.KeyController.delete/2\n        (nerves_hub_api) lib/nerves_hub_api_web/controllers/key_controller.ex:1: NervesHubAPIWeb.KeyController.action/2\n        (nerves_hub_api) lib/nerves_hub_api_web/controllers/key_controller.ex:1: NervesHubAPIWeb.KeyController.phoenix_controller_pipeline/2\n        (nerves_hub_api) lib/nerves_hub_api_web/endpoint.ex:1: NervesHubAPIWeb.Endpoint.instrument/4\n        (phoenix) lib/phoenix/router.ex:275: Phoenix.Router.__call__/1\n        (nerves_hub_api) lib/nerves_hub_api_web/endpoint.ex:1: NervesHubAPIWeb.Endpoint.plug_builder_call/2\n        (nerves_hub_api) lib/plug/debugger.ex:122: NervesHubAPIWeb.Endpoint.\"call (overridable 3)\"/2\n        (nerves_hub_api) lib/nerves_hub_api_web/endpoint.ex:1: NervesHubAPIWeb.Endpoint.call/2\n        (phoenix) lib/phoenix/endpoint/cowboy2_handler.ex:33: Phoenix.Endpoint.Cowboy2Handler.init/2\n        (cowboy) /Users/jschneck/Developer/nerves/nerves_hub_web/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2\n        (cowboy) /Users/jschneck/Developer/nerves/nerves_hub_web/deps/cowboy/src/cowboy_stream_h.erl:274: :cowboy_stream_h.execute/3\n    \n\n## Connection details\n\n### Params\n\n    %{\"name\" => \"test\", \"org_name\" => \"nerveshub\"}\n\n### Request info\n\n  * URI: https://0.0.0.0:4002/orgs/nerveshub/keys/test\n  * Query string: \n\n### Headers\n  \n  * content-type: application/json\n  * host: 0.0.0.0:4002\n  * user-agent: hackney/1.13.0\n\n### Session\n\n    %{}\n", position: 0, token: nil}}}
@jjcarstens
Copy link
Contributor

Is this still an issue? I was testing deleting firmware from CLI today and it still had a deployment tied to it, but the error I got back was pretty and neat. Seems like something was implemented since this issue?

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

2 participants