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

error with bots #7

Closed
maxguzenski opened this issue May 19, 2017 · 2 comments
Closed

error with bots #7

maxguzenski opened this issue May 19, 2017 · 2 comments

Comments

@maxguzenski
Copy link

I'm receiving a lot of this on production:

exit: ** (exit) :function_clause
  File "lib/regex.ex", line 159, in Regex.match?(~r/(?:^|[^A-Z0-9-_]|[^A-Z0-9-]_|sprd-)(?:360Spider(-Image|-Video)?)/, nil)
  File "lib/ua_inspector/parser/bot.ex", line 31, in UAInspector.Parser.Bot.parse/2
  File "lib/ua_inspector/parser.ex", line 52, in UAInspector.Parser.parse/1
  File "lib/ua_inspector/server.ex", line 23, in UAInspector.Server.handle_call/3
  File "gen_server.erl", line 615, in :gen_server.try_handle_call/4
  File "gen_server.erl", line 647, in :gen_server.handle_msg/5
  File "proc_lib.erl", line 247, in :proc_lib.init_p_do_apply/3
  Module "Elixir.UAInspector.Server", in UAInspector.Server.init(:Argument__1)
@mneudert
Copy link
Member

It looks like you are not passing any user agent in to be parsed. An example for that might be calling Plug.Conn.get_req_header/2 when no header exists.

By arbitrary (and perhaps sort of bad) decision the interface currently actually requires a string so you should be fine by modifying your lookup a bit:

UAInspector.parse(user_agent || "")

That way your errors should go away until I have whipped together a new release so these failures are prevented in the first place...

@mneudert
Copy link
Member

I have just released a new version with the appropriate fix in place. If your problem still persists please re-open this issue or open a new one.

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