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 Handling #21

Closed
gernotkogler opened this issue Feb 12, 2025 · 5 comments
Closed

Error Handling #21

gernotkogler opened this issue Feb 12, 2025 · 5 comments

Comments

@gernotkogler
Copy link

I'm using Mailroom basically as shown here. When my app goes offline (for testing purposes), Mailroom crashes and takes my whole app down.

I can't find any error handling dealing with offline scenarios. Am I missing something?

@andrewtimberlake
Copy link
Owner

@gernotkogler How does your app go offline? I want to recreate the conditions and see what I can do

@gernotkogler
Copy link
Author

gernotkogler commented Feb 12, 2025

@andrewtimberlake I turn off my WIFI and start my app locally. This is what I get. Seems to happen only if I have no network when the app starts. If I go offline after the app started, it seems to reconnect as soon as the network is there again.

[error] GenServer #PID<0.923.0> terminating
** (MatchError) no match of right hand side value: {:error, ":nxdomain"}
(mailroom 0.5.1) lib/mailroom/imap.ex:262: Mailroom.IMAP.handle_call/3
(stdlib 5.2.3.3) gen_server.erl:1131: :gen_server.try_handle_call/4
(stdlib 5.2.3.3) gen_server.erl:1160: :gen_server.handle_msg/6
(stdlib 5.2.3.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.921.0>): {:connect, "mail.cyon.ch", 993, [verify: :verify_none]}
State: %{debug: false, ssl: true}
Client #PID<0.921.0> is alive

(stdlib 5.2.3.3) gen.erl:259: :gen.do_call/4
(elixir 1.18.2) lib/gen_server.ex:1125: GenServer.call/3
(mailroom 0.5.1) lib/mailroom/imap.ex:72: Mailroom.IMAP.connect/4
(avk_service 1.0.9) deps/mailroom/lib/mailroom/inbox.ex:91: AvkService.Boundary.ImapClient.handle_continue/2
(stdlib 5.2.3.3) gen_server.erl:1085: :gen_server.try_handle_continue/3
(stdlib 5.2.3.3) gen_server.erl:995: :gen_server.loop/7
(stdlib 5.2.3.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

[error] GenServer #PID<0.930.0> terminating
** (MatchError) no match of right hand side value: {:error, ":nxdomain"}
(mailroom 0.5.1) lib/mailroom/imap.ex:262: Mailroom.IMAP.handle_call/3
(stdlib 5.2.3.3) gen_server.erl:1131: :gen_server.try_handle_call/4
(stdlib 5.2.3.3) gen_server.erl:1160: :gen_server.handle_msg/6
(stdlib 5.2.3.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.929.0>): {:connect, "mail.cyon.ch", 993, [verify: :verify_none]}
State: %{debug: false, ssl: true}
Client #PID<0.929.0> is alive

(stdlib 5.2.3.3) gen.erl:259: :gen.do_call/4
(elixir 1.18.2) lib/gen_server.ex:1125: GenServer.call/3
(mailroom 0.5.1) lib/mailroom/imap.ex:72: Mailroom.IMAP.connect/4
(avk_service 1.0.9) deps/mailroom/lib/mailroom/inbox.ex:91: AvkService.Boundary.ImapClient.handle_continue/2
(stdlib 5.2.3.3) gen_server.erl:1085: :gen_server.try_handle_continue/3
(stdlib 5.2.3.3) gen_server.erl:995: :gen_server.loop/7
(stdlib 5.2.3.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

[error] GenServer #PID<0.932.0> terminating
** (MatchError) no match of right hand side value: {:error, ":nxdomain"}
(mailroom 0.5.1) lib/mailroom/imap.ex:262: Mailroom.IMAP.handle_call/3
(stdlib 5.2.3.3) gen_server.erl:1131: :gen_server.try_handle_call/4
(stdlib 5.2.3.3) gen_server.erl:1160: :gen_server.handle_msg/6
(stdlib 5.2.3.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.931.0>): {:connect, "mail.cyon.ch", 993, [verify: :verify_none]}
State: %{debug: false, ssl: true}
Client #PID<0.931.0> is alive

(stdlib 5.2.3.3) gen.erl:259: :gen.do_call/4
(elixir 1.18.2) lib/gen_server.ex:1125: GenServer.call/3
(mailroom 0.5.1) lib/mailroom/imap.ex:72: Mailroom.IMAP.connect/4
(avk_service 1.0.9) deps/mailroom/lib/mailroom/inbox.ex:91: AvkService.Boundary.ImapClient.handle_continue/2
(stdlib 5.2.3.3) gen_server.erl:1085: :gen_server.try_handle_continue/3
(stdlib 5.2.3.3) gen_server.erl:995: :gen_server.loop/7
(stdlib 5.2.3.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

[error] GenServer #PID<0.934.0> terminating
** (MatchError) no match of right hand side value: {:error, ":nxdomain"}
(mailroom 0.5.1) lib/mailroom/imap.ex:262: Mailroom.IMAP.handle_call/3
(stdlib 5.2.3.3) gen_server.erl:1131: :gen_server.try_handle_call/4
(stdlib 5.2.3.3) gen_server.erl:1160: :gen_server.handle_msg/6
(stdlib 5.2.3.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.933.0>): {:connect, "mail.cyon.ch", 993, [verify: :verify_none]}
State: %{debug: false, ssl: true}
Client #PID<0.933.0> is alive

(stdlib 5.2.3.3) gen.erl:259: :gen.do_call/4
(elixir 1.18.2) lib/gen_server.ex:1125: GenServer.call/3
(mailroom 0.5.1) lib/mailroom/imap.ex:72: Mailroom.IMAP.connect/4
(avk_service 1.0.9) deps/mailroom/lib/mailroom/inbox.ex:91: AvkService.Boundary.ImapClient.handle_continue/2
(stdlib 5.2.3.3) gen_server.erl:1085: :gen_server.try_handle_continue/3
(stdlib 5.2.3.3) gen_server.erl:995: :gen_server.loop/7
(stdlib 5.2.3.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

[notice] Application avk_service exited: shutdown

@andrewtimberlake
Copy link
Owner

I’ve pushed a change that will exit rather than crash on connection failure. You will need to handle the retries in your supervisor.
Let me know if this works for you.

@gernotkogler
Copy link
Author

Looks good, thanks!

@andrewtimberlake
Copy link
Owner

I’ve released 0.5.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

2 participants