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

Return nice error from handle_prepare if unknown column type in row description #203

Open
fishcakez opened this issue Oct 19, 2017 · 0 comments

Comments

@fishcakez
Copy link
Contributor

It would be good to return a nice error when we don't know how to decode a value, instead of crashing in obscure way after query executed. This means we won't execute a binary query if we don't think we can decode it.

For example (copied from #119 (comment)):

[error] #PID<0.808.0> running MyApp.Endpoint terminated
Server: localhost:4000 (http)
Request: GET /errors/api/errors
** (exit) an exception was raised:
    ** (FunctionClauseError) no function clause matching in Mariaex.Messages.__type__/2
        (mariaex) lib/mariaex/messages.ex:76: Mariaex.Messages.__type__(:type, 245)
        (mariaex) lib/mariaex/row_parser.ex:17: anonymous fn/2 in Mariaex.RowParser.decode_init/1
        (elixir) lib/enum.ex:1755: Enum."-reduce/3-lists^foldl/2-0-"/3
        (mariaex) lib/mariaex/row_parser.ex:16: Mariaex.RowParser.decode_init/1
        (mariaex) lib/mariaex/protocol.ex:537: Mariaex.Protocol.bin_rows_recv/2
        (mariaex) lib/mariaex/protocol.ex:506: Mariaex.Protocol.binary_query_recv/1
        (mariaex) lib/mariaex/protocol.ex:490: Mariaex.Protocol.binary_query_recv/2
        (db_connection) lib/db_connection.ex:957: DBConnection.handle/4
        (db_connection) lib/db_connection.ex:1077: DBConnection.describe_run/5
        (db_connection) lib/db_connection.ex:1141: anonymous fn/4 in DBConnection.run_meter/5
        (db_connection) lib/db_connection.ex:1198: DBConnection.run_begin/3
        (db_connection) lib/db_connection.ex:584: DBConnection.prepare_execute/4
        (ecto) lib/ecto/adapters/sql.ex:243: Ecto.Adapters.SQL.sql_call/6
        (ecto) lib/ecto/adapters/sql.ex:431: Ecto.Adapters.SQL.execute_and_cache/7
        (ecto) lib/ecto/repo/queryable.ex:130: Ecto.Repo.Queryable.execute/5
        (ecto) lib/ecto/repo/queryable.ex:35: Ecto.Repo.Queryable.all/4
        (flames) lib/web/controllers/errors_controller.ex:9: Flames.ErrorsController.index/2
        (flames) lib/web/controllers/errors_controller.ex:2: Flames.ErrorsController.action/2
        (flames) lib/web/controllers/errors_controller.ex:2: Flames.ErrorsController.phoenix_controller_pipeline/2
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

1 participant