-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
refactor(errors): improve error messages #390
refactor(errors): improve error messages #390
Conversation
803ce7f
to
80a9674
Compare
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.
Looks good @stefanblaginov !
I've placed a couple of comments for things that should be doublechecked.
Also, I feel there is more work we should be doing on error messages:
- Check that all those errors are actually used, some of them may be obsolete and could be removed
- Check for use of other errors that aren't listed in the
message/en.json
and use a different approach e.g.,throw new Error("This is some error which is thrown by hand")
So I wouldn't mind leaving your issue open and listing those are additional work that would be useful to do.
|
||
// set model to a Boolean | ||
cObject.model = true; | ||
( function() {serializer.toJSON(cObject);}).should.throw(/.+expected type String/); | ||
( function() {serializer.toJSON(cObject);}).should.throw('Model violation in the "org.acme.Vehicle#CAR_123" instance. The field "model" has a value of "true" (type of value: "boolean"). Expected type of value: "String".'); |
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.
Am I the only one finding those changes confusing, surely "1"
is a String!
@@ -233,7 +233,7 @@ describe('ObjectValidator', function () { | |||
|
|||
(function () { | |||
objectValidator.visit(concerto.getTypeDeclaration(data), parameters); | |||
}).should.throw(/Instance undefined has property previousOwners with type undefined that is not derived from test.Person\[\]/); | |||
}).should.throw('Instance "undefined" has a property "previousOwners" with type "undefined" that is not derived from "test.Person[]".'); |
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.
I'm wondering if the undefined
here is a bug? the sentence doesn't read quite right. Could we double check?
@@ -264,7 +264,7 @@ describe('ObjectValidator', function () { | |||
parameters.stack = new TypedStack(data); | |||
(function () { | |||
objectValidator.visit(concerto.getTypeDeclaration(data), parameters); | |||
}).should.throw(/expected a Relationship/); | |||
}).should.throw('Model violation in the "undefined" instance. Class "test.Person" has a value of "[object Object]". Expected a "Relationship".'); |
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.
I'm wondering if the undefined
here is a bug? the sentence doesn't read quite right. Could we double check?
Signed-off-by: Stefan Blaginov <[email protected]>
80a9674
to
f45cadc
Compare
Signed-off-by: Stefan Blaginov <[email protected]>
3e0c82e
to
219cbf6
Compare
Closes #389
Changes
https://ux.stackexchange.com/questions/18671/periods-at-the-end-of-a-sentence-in-alert-message
https://stackoverflow.com/questions/1136829/do-you-end-your-exception-messages-with-a-period
Flags
Code dependant on parsing
concerto-core
error messages is likely to break from this change.Author Checklist
--signoff
option of git commit.master
fromfork:branchname