Remove throwing declarations
This commit is contained in:
parent
5381b28386
commit
0a5139fd39
@ -27,8 +27,8 @@ final class SQLiteDatabase {
|
|||||||
|
|
||||||
private let mail: MailConfig?
|
private let mail: MailConfig?
|
||||||
|
|
||||||
init(db: Database, mail: Configuration.EMail?) throws {
|
init(db: Database, mail: Configuration.EMail?) {
|
||||||
self.tables = try TableManagement(db: db)
|
self.tables = TableManagement(db: db)
|
||||||
guard let mail else {
|
guard let mail else {
|
||||||
self.mail = nil
|
self.mail = nil
|
||||||
return
|
return
|
||||||
|
@ -17,7 +17,7 @@ final class TableManagement {
|
|||||||
Load the tables from a file in the storage folder
|
Load the tables from a file in the storage folder
|
||||||
- Throws: Errors when the file could not be read
|
- 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
|
Table.query(on: db).with(\.$players).all().whenSuccess { loadedTables in
|
||||||
for table in loadedTables {
|
for table in loadedTables {
|
||||||
guard !table.players.isEmpty else {
|
guard !table.players.isEmpty else {
|
||||||
|
@ -55,7 +55,7 @@ public func configure(_ app: Application) throws {
|
|||||||
app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory))
|
app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory))
|
||||||
|
|
||||||
let db = app.databases.database(.sqlite, logger: .init(label: "Init"), on: app.databases.eventLoopGroup.next())!
|
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
|
// Gracefully shut down by closing potentially open socket
|
||||||
DispatchQueue.global(qos: .utility).asyncAfter(deadline: .now() + .seconds(5)) {
|
DispatchQueue.global(qos: .utility).asyncAfter(deadline: .now() + .seconds(5)) {
|
||||||
@ -65,7 +65,7 @@ public func configure(_ app: Application) throws {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// register routes
|
// register routes
|
||||||
try routes(app)
|
routes(app)
|
||||||
|
|
||||||
status.update(.nominal)
|
status.update(.nominal)
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ func encodeJSON<T>(_ response: T) throws -> String where T: Encodable {
|
|||||||
return String(data: data, encoding: .utf8)!
|
return String(data: data, encoding: .utf8)!
|
||||||
}
|
}
|
||||||
|
|
||||||
func routes(_ app: Application) throws {
|
func routes(_ app: Application) {
|
||||||
registerPlayer(app)
|
registerPlayer(app)
|
||||||
requestPlayerPasswordReset(app)
|
requestPlayerPasswordReset(app)
|
||||||
resetPlayerPasswordWithEmailToken(app)
|
resetPlayerPasswordWithEmailToken(app)
|
||||||
|
Loading…
Reference in New Issue
Block a user