Skip to content

Commit

Permalink
#68: conversion error messages contain the "database" word.
Browse files Browse the repository at this point in the history
  • Loading branch information
groue committed Jun 5, 2016
1 parent 30864a1 commit 1d4bff1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions GRDB/Core/DatabaseValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public struct DatabaseValue {
return value
}
guard isNull else {
fatalError("could not convert \(self) to \(Value.self).")
fatalError("could not convert database value \(self) to \(Value.self)")
}
return nil
}
Expand All @@ -102,7 +102,7 @@ public struct DatabaseValue {
@warn_unused_result
public func value<Value: DatabaseValueConvertible>() -> Value {
guard let value = Value.fromDatabaseValue(self) as Value? else {
fatalError("could not convert \(self) to \(Value.self).")
fatalError("could not convert database value \(self) to \(Value.self)")
}
return value
}
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Core/Row.swift
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ extension Row {
return impl.databaseValue(atIndex: index).value()
}
guard sqlite3_column_type(sqliteStatement, Int32(index)) != SQLITE_NULL else {
fatalError("could not convert NULL to \(Value.self).")
fatalError("could not convert database NULL value to \(Value.self)")
}
return Value.init(sqliteStatement: sqliteStatement, index: Int32(index))
}
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Core/StatementColumnConvertible.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public extension DatabaseValueConvertible where Self: StatementColumnConvertible
let sqliteStatement = statement.sqliteStatement
return statement.fetchSequence(arguments: arguments) {
guard sqlite3_column_type(sqliteStatement, 0) != SQLITE_NULL else {
fatalError("could not convert NULL to \(Self.self).")
fatalError("could not convert database NULL value to \(Self.self)")
}
return Self.init(sqliteStatement: sqliteStatement, index: 0)
}
Expand Down
4 changes: 2 additions & 2 deletions GRDB/Core/Support/Foundation/NSNumber.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ extension NSNumber: DatabaseValueConvertible {
return Int64(longValue).databaseValue
case "L":
let uint = unsignedLongValue
GRDBPrecondition(UInt64(uint) <= UInt64(Int64.max), "could not convert \(uint) to Int64")
GRDBPrecondition(UInt64(uint) <= UInt64(Int64.max), "could not convert \(uint) to an Int64 that can be stored in the database")
return Int64(uint).databaseValue
case "q":
return Int64(longLongValue).databaseValue
case "Q":
let uint64 = unsignedLongLongValue
GRDBPrecondition(uint64 <= UInt64(Int64.max), "could not convert \(uint64) to Int64")
GRDBPrecondition(uint64 <= UInt64(Int64.max), "could not convert \(uint64) to an Int64 that can be stored in the database")
return Int64(uint64).databaseValue
case "f":
return Double(floatValue).databaseValue
Expand Down
4 changes: 2 additions & 2 deletions GRDB/Core/Support/StandardLibrary/StandardLibrary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ extension Int: DatabaseValueConvertible, StatementColumnConvertible {
/// - index: The column index.
public init(sqliteStatement: SQLiteStatement, index: Int32) {
let int64 = sqlite3_column_int64(sqliteStatement, index)
GRDBPrecondition(int64 >= Int64(Int.min) && int64 <= Int64(Int.max), "could not convert \(int64) to Int")
GRDBPrecondition(int64 >= Int64(Int.min) && int64 <= Int64(Int.max), "could not convert database value \(int64) to Int")
self = Int(int64)
}

Expand Down Expand Up @@ -152,7 +152,7 @@ extension Int32: DatabaseValueConvertible, StatementColumnConvertible {
/// - index: The column index.
public init(sqliteStatement: SQLiteStatement, index: Int32) {
let int64 = sqlite3_column_int64(sqliteStatement, index)
GRDBPrecondition(int64 >= Int64(Int32.min) && int64 <= Int64(Int32.max), "could not convert \(int64) to Int32")
GRDBPrecondition(int64 >= Int64(Int32.min) && int64 <= Int64(Int32.max), "could not convert database value \(int64) to Int32")
self = Int32(int64)
}

Expand Down

0 comments on commit 1d4bff1

Please sign in to comment.