electric-sql / legacy-cli

ElectricSQL command line interface (CLI) tool.
https://electric-sql.com/docs
Apache License 2.0
10 stars 0 forks source link

Handle invalid migration response from console #15

Closed magnetised closed 1 year ago

linear[bot] commented 1 year ago
VAX-455 CLI doesn't properly format 422 response from the server

``` electric migrations sync ⠋ Synchronizing migrations … app_id: yielding-scene-6712 ⠸ Synchronizing migrations … warning: Caught exception in Elixir.Electric.main/1: :error => {:case_clause, {:ok, %Req.Response{ body: %{ "errors" => %{"original_body" => ["The table items is not STRICT."]} }, headers: [ {"cache-control", "max-age=0, private, must-revalidate"}, {"content-length", "63"}, {"content-type", "application/json; charset=utf-8"}, {"date", "Mon, 12 Dec 2022 16:02:25 GMT"}, {"server", "istio-envoy"}, {"strict-transport-security", "max-age=31536000; preload; includeSubDomains"}, {"x-request-id", "c6d9b74b-0932-4d50-b871-90d8976eda17"}, {"x-envoy-upstream-service-time", "41"} ], private: %{}, status: 422 }}} (electric_sql_cli 0.1.0) lib/electric/migrations/sync.ex:186: Electric.Migrations.Sync.upload_new_migration/3 (electric_sql_cli 0.1.0) lib/electric/migrations/sync.ex:172: anonymous fn/4 in Electric.Migrations.Sync.upload_new_migrations/3 (elixir 1.13.4) lib/enum.ex:4475: Enumerable.List.reduce/3 (elixir 1.13.4) lib/enum.ex:2442: Enum.reduce_while/3 (electric_sql_cli 0.1.0) lib/electric/migrations/sync.ex:11: Electric.Migrations.Sync.sync_migrations/3 (electric_sql_cli 0.1.0) lib/electric/migrations/migrations.ex:105: Electric.Migrations.sync_migrations/2 (electric_sql_cli 0.1.0) lib/electric/commands/migrations.ex:279: anonymous fn/2 in Electric.Commands.Migrations.sync/1 (electric_sql_cli 0.1.0) lib/electric/progress.ex:104: Electric.Progress.run_for_min_duration/2 ```