Skip to content

Commit

Permalink
Update docs/creation/supply-chain.md
Browse files Browse the repository at this point in the history
Co-authored-by: Ryan A. Hagenson <[email protected]>
  • Loading branch information
SeanTAllen and rhagenson committed Jan 11, 2024
1 parent 2824bf0 commit 9779908
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/creation/supply-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ actor TempWriter
_file.write(it)
```

We've already hit our first problem. Our above code won't compile. Why? Well, it doesn't handle errors. For starters, `FilePath.mkdtemp(auth)?` and `FilePath.from(dir, file_name)?` can both fail. We might not be able to create the directory. If we were to address that, we would also need to address that our `File` object might not be able to be initialized. In order to deal with our errors, we'll need to make `file` be of type `(File | None)`. This union type states that we can have a file or nothing. An iteration to address this gets us almost all the way to being able to compile but not quite:
We've already hit our first problem. Our above code won't compile. Why? Well, it doesn't handle errors. For starters, `FilePath.mkdtemp(auth)?` and `FilePath.from(dir, file_name)?` can both fail. We might not be able to create the directory. If we were to address that, we would also need to address that our `File` object might not be able to be initialized. In order to deal with our errors, we'll need to make `_file` be of type `(File | None)`. This union type states that we can have a file or nothing. An iteration to address this gets us almost all the way to being able to compile but not quite:

```pony
use "files"
Expand Down

0 comments on commit 9779908

Please sign in to comment.