Add missing `else` to guard in docs (#955)

<!-- 🚀 Thank you for contributing! -->

<!-- Describe your changes clearly and use examples if possible. -->
The code as is has a syntax error.

<!-- When this PR is merged, the title and body will be -->
<!-- used to generate a release automatically. -->
This commit is contained in:
William Sedlacek 2023-12-18 08:55:24 -08:00 committed by GitHub
parent fafc8baf14
commit e478d998a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 7 deletions

View File

@ -48,7 +48,7 @@ struct TodosController: RouteCollection {
}
func delete(req: Request) async throws -> HTTPStatus {
guard let todo = try await Todo.find(req.parameters.get("id"), on: req.db) {
guard let todo = try await Todo.find(req.parameters.get("id"), on: req.db) else {
throw Abort(.notFound)
}
try await todo.delete(on: req.db)
@ -65,4 +65,4 @@ Zum Schluss müssen wir der Anwendung unseren Controller bekannt machen. Hierzu
// [routes.swift]
try app.register(collection: TodosController())
```
```

View File

@ -52,7 +52,7 @@ struct TodosController: RouteCollection {
}
func delete(req: Request) async throws -> HTTPStatus {
guard let todo = try await Todo.find(req.parameters.get("id"), on: req.db) {
guard let todo = try await Todo.find(req.parameters.get("id"), on: req.db) else {
throw Abort(.notFound)
}
try await todo.delete(on: req.db)

View File

@ -52,7 +52,7 @@ struct TodosController: RouteCollection {
}
func delete(req: Request) async throws -> HTTPStatus {
guard let todo = try await Todo.find(req.parameters.get("id"), on: req.db) {
guard let todo = try await Todo.find(req.parameters.get("id"), on: req.db) else {
throw Abort(.notFound)
}
try await todo.delete(on: req.db)

View File

@ -52,7 +52,7 @@ struct TodosController: RouteCollection {
}
func delete(req: Request) async throws -> HTTPStatus {
guard let todo = try await Todo.find(req.parameters.get("id"), on: req.db) {
guard let todo = try await Todo.find(req.parameters.get("id"), on: req.db) else {
throw Abort(.notFound)
}
try await todo.delete(on: req.db)

View File

@ -52,7 +52,7 @@ struct TodosController: RouteCollection {
}
func delete(req: Request) async throws -> HTTPStatus {
guard let todo = try await Todo.find(req.parameters.get("id"), on: req.db) {
guard let todo = try await Todo.find(req.parameters.get("id"), on: req.db) else {
throw Abort(.notFound)
}
try await todo.delete(on: req.db)

View File

@ -53,7 +53,7 @@ struct TodosController: RouteCollection {
}
func delete(req: Request) async throws -> HTTPStatus {
guard let todo = try await Todo.find(req.parameters.get("id"), on: req.db) {
guard let todo = try await Todo.find(req.parameters.get("id"), on: req.db) else {
throw Abort(.notFound)
}
try await todo.delete(on: req.db)