Commit c2fbaa4
authored
Don't error on cancelled startup to make it not necessary to export
This change's driven by the proposal in #830. When client start up is
cancelled by a stop, we'd return `ErrShutdown` as a special signal. The
problem is that `ErrShutdown` was never exported, so this wasn't really
usable by outside callers.
In #830 it was proposed to export `ErrShutdown`. However, after some
discussion, we suspect that it might be better to leave it unexported,
and then have `Start` return no error on cancelled startup. This
minimizes the number of startup conditions callers have to handle.
Because `ErrShutdown` wasn't previously exported, we should be able to
make this change safely without breaking anyone.
@mastercactapus did bring up a fair point that the alternative of
exporting `ErrShutdown` would allow a caller to definitively tell the
difference between the client successfully starting and backgrounding
itself versus one whose start was cancelled. I think we're okay not to
require that differentiation though because if `ErrShutdown` would've be
returned, then the caller would have called `Stop`, so presumably they'd
know to expect an successful start.
I figure that in case a strong case for wanting to differentiate the
cases comes through, we could always resurrect the error.
Also, rename the internal `ErrShutdown` to `ErrStop` to be more
consistent with the naming of `Client.Stop` (which had previously been
called `Shutdown`). This won't make any difference, but will be a little
better in case we ever do export it and then forget to rename it at that
time.ErrShutdown (#841)1 parent 6a01986 commit c2fbaa4
4 files changed
Lines changed: 12 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
888 | 888 | | |
889 | 889 | | |
890 | 890 | | |
891 | | - | |
| 891 | + | |
892 | 892 | | |
893 | 893 | | |
894 | 894 | | |
| |||
928 | 928 | | |
929 | 929 | | |
930 | 930 | | |
931 | | - | |
| 931 | + | |
932 | 932 | | |
933 | 933 | | |
934 | 934 | | |
| |||
985 | 985 | | |
986 | 986 | | |
987 | 987 | | |
988 | | - | |
| 988 | + | |
989 | 989 | | |
990 | 990 | | |
991 | 991 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
| 347 | + | |
351 | 348 | | |
352 | 349 | | |
353 | 350 | | |
| |||
1104 | 1101 | | |
1105 | 1102 | | |
1106 | 1103 | | |
1107 | | - | |
| 1104 | + | |
1108 | 1105 | | |
1109 | 1106 | | |
1110 | 1107 | | |
| |||
1405 | 1402 | | |
1406 | 1403 | | |
1407 | 1404 | | |
1408 | | - | |
1409 | 1405 | | |
1410 | 1406 | | |
1411 | 1407 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
| 23 | + | |
| 24 | + | |
0 commit comments