-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
52 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Foundation | ||
|
||
public enum QueryError: Error, CustomStringConvertible { | ||
case noSuchTable(name: String) | ||
case noSuchColumn(name: String, columns: [String]) | ||
case ambiguousColumn(name: String, similar: [String]) | ||
|
||
public var description: String { | ||
switch self { | ||
case .noSuchTable(let name): | ||
return "No such table: \(name)" | ||
case .noSuchColumn(let name, let columns): | ||
return "No such column `\(name)` in columns \(columns)" | ||
case .ambiguousColumn(let name, let similar): | ||
return "Ambiguous column `\(name)` (please disambiguate: \(similar))" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Won't this still crash if there's a type mismatch?