From 0a5139fd3973f232cbddda5ca19d3122a8ee8884 Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Tue, 31 Jan 2023 22:17:15 +0100 Subject: [PATCH] Remove throwing declarations --- Sources/App/Management/SQLiteDatabase.swift | 4 ++-- Sources/App/Management/TableManagement.swift | 2 +- Sources/App/configure.swift | 4 ++-- Sources/App/routes.swift | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/App/Management/SQLiteDatabase.swift b/Sources/App/Management/SQLiteDatabase.swift index 926e1a2..c8dfa18 100644 --- a/Sources/App/Management/SQLiteDatabase.swift +++ b/Sources/App/Management/SQLiteDatabase.swift @@ -27,8 +27,8 @@ final class SQLiteDatabase { private let mail: MailConfig? - init(db: Database, mail: Configuration.EMail?) throws { - self.tables = try TableManagement(db: db) + init(db: Database, mail: Configuration.EMail?) { + self.tables = TableManagement(db: db) guard let mail else { self.mail = nil return diff --git a/Sources/App/Management/TableManagement.swift b/Sources/App/Management/TableManagement.swift index b9c5ecd..0578ad3 100644 --- a/Sources/App/Management/TableManagement.swift +++ b/Sources/App/Management/TableManagement.swift @@ -17,7 +17,7 @@ final class TableManagement { Load the tables from a file in the storage folder - Throws: Errors when the file could not be read */ - init(db: Database) throws { + init(db: Database) { Table.query(on: db).with(\.$players).all().whenSuccess { loadedTables in for table in loadedTables { guard !table.players.isEmpty else { diff --git a/Sources/App/configure.swift b/Sources/App/configure.swift index 8b39e0f..a753b7f 100644 --- a/Sources/App/configure.swift +++ b/Sources/App/configure.swift @@ -55,7 +55,7 @@ public func configure(_ app: Application) throws { app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory)) let db = app.databases.database(.sqlite, logger: .init(label: "Init"), on: app.databases.eventLoopGroup.next())! - server = try SQLiteDatabase(db: db, mail: configuration.mail) + server = SQLiteDatabase(db: db, mail: configuration.mail) // Gracefully shut down by closing potentially open socket DispatchQueue.global(qos: .utility).asyncAfter(deadline: .now() + .seconds(5)) { @@ -65,7 +65,7 @@ public func configure(_ app: Application) throws { } // register routes - try routes(app) + routes(app) status.update(.nominal) } diff --git a/Sources/App/routes.swift b/Sources/App/routes.swift index eb08790..a3f34db 100644 --- a/Sources/App/routes.swift +++ b/Sources/App/routes.swift @@ -14,7 +14,7 @@ func encodeJSON(_ response: T) throws -> String where T: Encodable { return String(data: data, encoding: .utf8)! } -func routes(_ app: Application) throws { +func routes(_ app: Application) { registerPlayer(app) requestPlayerPasswordReset(app) resetPlayerPasswordWithEmailToken(app)