error-handling.md 584 B

Error handling

Before we continue, we need to quickly add some error handling to handle the case where a user forgets to add the command-line flag.

{{#include ../../../../../example/dchat/src/dchat_error.rs:1:12}}

Finally we can read the flag from the command-line by adding the following lines to main():

{{#include ../../../../../example/dchat/src/main.rs:13:14}}
{{#include ../../../../../example/dchat/src/main.rs:18}}

{{#include ../../../../../example/dchat/src/main.rs:182:191}}
//...
{{#include ../../../../../example/dchat/src/main.rs:224}}