-
Notifications
You must be signed in to change notification settings - Fork 14
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
Start of 404 and 426 implementation for getTitles #31
Conversation
CassandraBackend.prototype.getTest = function (clientCommit, clientDate, cb) { | ||
var retry = this.getTestToRetry(), | ||
lastCommitTimestamp = this.commits[0].timestamp, | ||
retVal = 404; |
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.
Somehow directly returning HTTP status codes from the backend feels wrong to me. Maybe we can re-define getTest to return an object with an 'error' member instead? Something like this:
{ error: { code: 404, message: 'No tests to run for this commit' } } // error case
{ error: { code: 426, message: 'Commit too old' } } // error case
{ test: '{prefix:....}'} // no error
But really we should probably use names:
{ error: { code: 'ResourceNotFoundError', message: 'No tests to run for this commit' } } // error case
{ error: { code: 'BadCommitError', message: 'Commit too old' } } // error case
According to http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-16#page-34 426 actually means something else. Code 400 (Bad Request) seems to be more accurate.
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 would be somewhat similar to http://mcavage.me/node-restify/#Error-handling
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.
The parsoid client currently accepts 426 as the suicide status code. That logic will have to be changed in the client at some point.
Start of 404 and 426 implementation for getTitles
This pull request begins implementation of the 404 (no titles available) and 426 (old commit, client should commit suicide) status codes in getTitle.
Old commit logic by putting an old TID into commits table and 404 tested by emptying out local Cassandra data store.