When starting a process under supervision the supervisor is given a start function for the child.
This start function must return one of the following.
{:ok, pid}
{:ok, pid, term}
:ignore
{:error, reason}
https://erlang.org/doc/man/supervisor.html
I’m trying to find examples for all the reason you might have a process fail to start.
The reasons I have found so far are.
-
Invalid configuration
For example a database that takes a url as start argument but the string might not be a valid database url.
DB.start_link(url: "!I'm no url")
-
Unavailable external service
When starting a process if it cannot connect to a required resource then the pid fails to start. Again failing to connect to a database is an example of this. -
Process name is already taken
Process can be started with Atom names, if the name is already taken the process would fail to start.
If you can think of any additions to this list I would greatly appreciate them. Examples would be even more awesome, thank you.