Skip to content
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

Merged
merged 6 commits into from
Mar 20, 2014
Merged

Start of 404 and 426 implementation for getTitles #31

merged 6 commits into from
Mar 20, 2014

Conversation

swong15
Copy link
Collaborator

@swong15 swong15 commented Mar 16, 2014

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.

@swong15
Copy link
Collaborator Author

swong15 commented Mar 16, 2014

#16

CassandraBackend.prototype.getTest = function (clientCommit, clientDate, cb) {
var retry = this.getTestToRetry(),
lastCommitTimestamp = this.commits[0].timestamp,
retVal = 404;
Copy link
Owner

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.

Copy link
Owner

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

Copy link
Collaborator Author

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.

gwicke added a commit that referenced this pull request Mar 20, 2014
Start of 404 and 426 implementation for getTitles
@gwicke gwicke merged commit 01f0269 into gwicke:master Mar 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants