-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Missing driver exception annotations #4130
Missing driver exception annotations #4130
Conversation
…ssertion The situation reported as an exception is unlikely to happen and there's no test that reproduces it.
fd42f52
to
980c68c
Compare
@SenseException could you review this, please? There was needed a rebase due to a conflict in |
Ping @greg0ire. |
{ | ||
public static function new(int $parameter): self | ||
{ | ||
return new self(sprintf('A non-stream resource passed as a LARGE_OBJECT parameter #%d', $parameter)); |
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 sentence feels a bit weird to me, I'd either use
return new self(sprintf('A non-stream resource passed as a LARGE_OBJECT parameter #%d', $parameter)); | |
return new self(sprintf('A non-stream resource was passed as a LARGE_OBJECT parameter #%d', $parameter)); |
or
return new self(sprintf('A non-stream resource passed as a LARGE_OBJECT parameter #%d', $parameter)); | |
return new self(sprintf('Non-stream resource passed as a LARGE_OBJECT parameter #%d', $parameter)); |
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.
What if we get rid of the past tense here and change it to something like: 'The resource passed as a LARGE_OBJECT parameter must be of type "stream"?' It will be more about how to fix the problem, not just the problem statement.
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.
As a side note, have you seen any articles/guides specifically on composing error messages? E.g. in navigation it seems acceptable to sacrifice the grammatical correctness of sentence in favor of brevity: do not lean on door). And many other computer programs I saw (especially in the past) would use this principle as well.
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.
As another side note, we probably can get rid of this exception and let the underlying driver decide whether it can bind this resource to the statement or not. Then the message (if it's clear enough) may come directly from the driver (should be easier to google).
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.
As a side note, have you seen any articles/guides specifically on composing error messages? E.g. in navigation it seems acceptable to sacrifice the grammatical correctness of a sentence in favor of brevity: do not lean on door). And many other computer programs I saw (especially in the past) would use this principle as well.
I didn't but it's an interesting topic for sure!
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.
Just googled it for myself and will leave it here:
Signs often have reduced grammar, as do newspaper headlines, captions of photographs, and so on. They may omit articles and auxiliary verbs, for example. We're so used to this that it might actually sound strange to use a complete sentence in such situations.
This is by no means a justification for my illiteracy.
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.
Haha I stumbled upon this blog post that refers to us while looking this up: http://rosstuck.com/formatting-exception-messages
This one is quite interesting: https://softwareengineering.stackexchange.com/questions/29433/how-to-write-a-good-exception-message, but more about the contents than the form.
This one advocates against brevity: http://amortizedcost.net/writing-good-exception-message/
IMO there might have been a point in brevity in the past, when memory was an issue, but nowadays we might want to revisit that thought and start using multiline exception messages (php 7.3 makes heredoc and nowdoc nicer BTW) , which detail the context, the problem and solutions as suggested in the second link.
980c68c
to
4f7c86f
Compare
@throws
annotation.OCI8\Connection::getServerVersion()
no longer throws anUnexpectedValueException
.Mysqli\Statement::bindTypedParameters()
andPDO\Statement::convertParamType()
no longer throw anInvalidArgumentException
.Driver\Exeption
.