-
-
Notifications
You must be signed in to change notification settings - Fork 82
Updates PostgresCastingError to PostgresDecodingError #286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are getting closer 🎉. We are missing three publics, at one point the indentations is wrong, and for whatever the reason the script printed a lot of -n
.
struct PostgresCastingError: Error, Equatable { | ||
@usableFromInline | ||
struct Code: Hashable, Error { | ||
struct PostgresDecodingError: Error, Equatable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are missing a public
here.
@@ -167,7 +155,7 @@ struct PostgresCastingError: Error, Equatable { | |||
} | |||
|
|||
@usableFromInline | |||
static func ==(lhs: PostgresCastingError, rhs: PostgresCastingError) -> Bool { | |||
static func ==(lhs: PostgresDecodingError, rhs: PostgresDecodingError) -> Bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are missing a public
here.
var description: String { | ||
// This may seem very odd... But we are afraid that users might accidentally send the | ||
// unfiltered errors out to end-users. This may leak security relevant information. For this | ||
// reason we overwrite the error description by default to this generic "Database error" | ||
"Database error" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are missing a public
here. Also this is indented with only 2 spaces.
echo " } catch let code as PostgresDecodingError.Code {" | ||
echo " throw PostgresDecodingError(" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix looks correct!
-n public func decode<T0: PostgresDecodable | ||
-n , JSONDecoder: PostgresJSONDecoder>(_: (T0 | ||
-n ).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) throws | ||
-n -> (T0 | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does echo suddenly print the -n
. @gwynne do you have an idea why this might be happening?
I believe the pull request has been updated with the previous changes including a fix to the -n issue caused by dev/generate-postgresrow-multi-decode.sh |
Awesome! this looks much better already! However CI is still failing. Looks like a find & replace for the remaining usages of: |
@nicholas-otto We are nearly there! Looks like you ran into a small typo: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great change! Thank you!
This updates from PostgresCastingError to PostgresDecodingError and changes associated files. This includes the update to the PostgresErrorTests.swift file in its testPostgresCastingErrorDescription() and the resolution of @usableFromInline tags. I believe it addresses all the issues from the previous pull request Patch 2 #282 and is in response to issue #278.