mirror of https://github.com/vapor/docs.git
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:
parent
fafc8baf14
commit
e478d998a8
|
|
@ -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())
|
||||
```
|
||||
```
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue