wfleming / fourohfourfinder

MIT License
2 stars 0 forks source link

Phoenix crash rendering some responses #2

Closed wfleming closed 8 years ago

wfleming commented 8 years ago

Seems to parse & generate description of http://minikanren.org/ alright, but crashes when rendering response.

Request: POST /api/page/fetch
** (exit) an exception was raised:
    ** (FunctionClauseError) no function clause matching in Poison.Encoder.BitString.chunk_size/3
        (poison) lib/poison/encoder.ex:127: Poison.Encoder.BitString.chunk_size(<<237, 109, 105, 114, 75, 97, 110, 114, 101, 110>>, nil, 1)
        (poison) lib/poison/encoder.ex:122: Poison.Encoder.BitString.escape/2
        (poison) lib/poison/encoder.ex:84: Poison.Encoder.BitString.encode/2
        (poison) lib/poison/encoder.ex:213: anonymous fn/4 in Poison.Encoder.Map.encode/3
        (poison) lib/poison/encoder.ex:214: Poison.Encoder.Map."-encode/3-lists^foldl/2-0-"/3
        (poison) lib/poison/encoder.ex:214: Poison.Encoder.Map.encode/3
        (poison) lib/poison/encoder.ex:232: anonymous fn/3 in Poison.Encoder.List.encode/3
        (poison) lib/poison/encoder.ex:233: Poison.Encoder.List."-encode/3-lists^foldr/2-1-"/3
        (poison) lib/poison/encoder.ex:233: Poison.Encoder.List.encode/3
        (poison) lib/poison/encoder.ex:213: anonymous fn/4 in Poison.Encoder.Map.encode/3
        (poison) lib/poison/encoder.ex:214: Poison.Encoder.Map."-encode/3-lists^foldl/2-0-"/3
        (poison) lib/poison/encoder.ex:214: Poison.Encoder.Map.encode/3
        (poison) lib/poison.ex:41: Poison.encode!/2
        (phoenix) lib/phoenix/controller.ex:633: Phoenix.Controller.do_render/4
        (four_oh_four_finder) web/controllers/api/page_controller.ex:1: FourOhFourFinderApp.Api.PageController.action/2
        (four_oh_four_finder) web/controllers/api/page_controller.ex:1: FourOhFourFinderApp.Api.PageController.phoenix_controller_pipeline/2
        (four_oh_four_finder) lib/phoenix/router.ex:261: FourOhFourFinderApp.Router.dispatch/2
        (four_oh_four_finder) web/router.ex:1: FourOhFourFinderApp.Router.do_call/2
        (four_oh_four_finder) lib/raygun/plug.ex:54: FourOhFourFinderApp.Router.call/2
        (four_oh_four_finder) lib/four_oh_four_finder/endpoint.ex:1: FourOhFourFinderApp.Endpoint.phoenix_pipeline/1
wfleming commented 8 years ago

The offending bit of text is "mímirKanren". It seems like going through Floki's parsing/processing turns strings into byte-lists at some point, and this results in Elixir no longer seeing the binary list as a valid string (because what should be a single code point > 255 got split into multiple bytes).