We need to add `source()` to provide a way for library users to access the underlying error (essentially, the `stderr` of the `sbotcli` which was invoked).
The Rust docs offer a clear example of how to implement this:
https://doc.rust-lang.org/std/error/trait.Error.html#method.source
Here's the output when I call sbotcli call whoami without a running go-sbot (it returns two errors):
level=warn client="unix-path based init failed" err="ssbClient: failed to open unix path \"/home/glyph/.ssb-go/socket\""
level=error run-failure="init: failed to connect to 127.0.0.1:8008|@ZPKL+7GG2D5rAwu74tr1CHZNr+ODxdCCA9zwFFIZXl4=.ed25519: error dialing: error wrapping connection: secrethandshake: failed during data transfer of receiving server auth: EOF"
In our library as it currently exists, this would result in the following error being displayed to the library user:
Error calling whoami: level=warn client="unix-path based init failed" err="ssbClient: failed to open unix path \"/home/glyph/.ssb-go/socket\""
level=error run-failure="init: failed to connect to 127.0.0.1:8008|@ZPKL+7GG2D5rAwu74tr1CHZNr+ODxdCCA9zwFFIZXl4=.ed25519: error dialing: error wrapping connection: secrethandshake: failed during data transfer of receiving server auth: EOF"
My current thought is that the basic error message that gets returned to the library caller should read like this:
Error calling whoami: failed to open unix path \"/home/glyph/.ssb-go/socket\"
or perhaps
Error calling whoami: failed to connect to 127.0.0.1:8008|@ZPKL+7GG2D5rAwu74tr1CHZNr+ODxdCCA9zwFFIZXl4=.ed25519
Then the err.source() would return the full stderr from the failed call:
level=warn client="unix-path based init failed" err="ssbClient: failed to open unix path \"/home/glyph/.ssb-go/socket\""
level=error run-failure="init: failed to connect to 127.0.0.1:8008|@ZPKL+7GG2D5rAwu74tr1CHZNr+ODxdCCA9zwFFIZXl4=.ed25519: error dialing: error wrapping connection: secrethandshake: failed during data transfer of receiving server auth: EOF"
Thinking about this a bit more with an example:
Here's the output when I call `sbotcli call whoami` without a running `go-sbot` (it returns two errors):
```
level=warn client="unix-path based init failed" err="ssbClient: failed to open unix path \"/home/glyph/.ssb-go/socket\""
level=error run-failure="init: failed to connect to 127.0.0.1:8008|@ZPKL+7GG2D5rAwu74tr1CHZNr+ODxdCCA9zwFFIZXl4=.ed25519: error dialing: error wrapping connection: secrethandshake: failed during data transfer of receiving server auth: EOF"
```
In our library as it currently exists, this would result in the following error being displayed to the library user:
```
Error calling whoami: level=warn client="unix-path based init failed" err="ssbClient: failed to open unix path \"/home/glyph/.ssb-go/socket\""
level=error run-failure="init: failed to connect to 127.0.0.1:8008|@ZPKL+7GG2D5rAwu74tr1CHZNr+ODxdCCA9zwFFIZXl4=.ed25519: error dialing: error wrapping connection: secrethandshake: failed during data transfer of receiving server auth: EOF"
```
My current thought is that the basic error message that gets returned to the library caller should read like this:
`Error calling whoami: failed to open unix path \"/home/glyph/.ssb-go/socket\"`
or perhaps
`Error calling whoami: failed to connect to 127.0.0.1:8008|@ZPKL+7GG2D5rAwu74tr1CHZNr+ODxdCCA9zwFFIZXl4=.ed25519`
Then the `err.source()` would return the full `stderr` from the failed call:
```
level=warn client="unix-path based init failed" err="ssbClient: failed to open unix path \"/home/glyph/.ssb-go/socket\""
level=error run-failure="init: failed to connect to 127.0.0.1:8008|@ZPKL+7GG2D5rAwu74tr1CHZNr+ODxdCCA9zwFFIZXl4=.ed25519: error dialing: error wrapping connection: secrethandshake: failed during data transfer of receiving server auth: EOF"
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
We need to add
source()to provide a way for library users to access the underlying error (essentially, thestderrof thesbotcliwhich was invoked).The Rust docs offer a clear example of how to implement this:
https://doc.rust-lang.org/std/error/trait.Error.html#method.source
Thinking about this a bit more with an example:
Here's the output when I call
sbotcli call whoamiwithout a runninggo-sbot(it returns two errors):In our library as it currently exists, this would result in the following error being displayed to the library user:
My current thought is that the basic error message that gets returned to the library caller should read like this:
Error calling whoami: failed to open unix path \"/home/glyph/.ssb-go/socket\"or perhaps
Error calling whoami: failed to connect to 127.0.0.1:8008|@ZPKL+7GG2D5rAwu74tr1CHZNr+ODxdCCA9zwFFIZXl4=.ed25519Then the
err.source()would return the fullstderrfrom the failed call: