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

Error status should contain only error code #67

Open
ypriverol opened this issue Apr 16, 2020 · 1 comment
Open

Error status should contain only error code #67

ypriverol opened this issue Apr 16, 2020 · 1 comment
Assignees
Labels
bug Something isn't working Implementation Issue related with one of the implementations

Comments

@ypriverol
Copy link
Contributor

Massive, PeptideAtlas, ProteomeCentral:

Screen Shot 2020-04-17 at 00 01 02

Hi, all, the Status Code in the URL should contain the word Not Implemented. It should be only the error code.

We think the way to thought the message should be in the body: http://wwwdev.ebi.ac.uk/pride/proxi/archive/v0.1/proteins?resultType=compact

Lets discuss in the next meeting

@edeutsch
Copy link
Contributor

At ProteomeCentral and PeptideAtlas, this is the way things look:

First, if you give a bad URL, then our Python flask framework returns an answer like this:

$ curl -i http://proteomecentral.proteomexchange.org/api/proxi/v0.1/xxx

HTTP/1.1 404 NOT FOUND
Date: Thu, 23 Apr 2020 04:20:23 GMT
Server: Werkzeug/0.16.0 Python/3.7.4
Content-Type: application/problem+json
Content-Length: 205
Access-Control-Allow-Origin: *

{
"detail": "The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

I modeled the 501 message after this:

$ curl -i http://proteomecentral.proteomexchange.org/api/proxi/v0.1/proteins?resultType=compact

HTTP/1.1 501 NOT IMPLEMENTED
Date: Thu, 23 Apr 2020 04:22:46 GMT
Server: Werkzeug/0.16.0 Python/3.7.4
Content-Type: application/json
Content-Length: 201
Access-Control-Allow-Origin: *
Connection: close

{
"detail": "Although this is an officially defined PROXI endpoint, it has not yet been implemented at this server",
"status": 501,
"title": "Endpoint not implemented",
"type": "about:blank"
}

At PRIDE, the framework returns something that doesn't exist like this:

$ curl -i http://wwwdev.ebi.ac.uk/pride/proxi/archive/v0.1/xxx

HTTP/1.1 404
Content-Type: application/json;charset=UTF-8
Date: Thu, 23 Apr 2020 04:24:00 GMT
Transfer-Encoding: chunked
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Access-Control-Allow-Headers, Authorization
X-Cache-Info: caching

{
"timestamp" : 1587615840686,
"status" : 404,
"error" : "Not Found",
"message" : "No message available",
"path" : "/pride/proxi/archive/v0.1/xxx"
}

and you're returning a 501 like this:

$ curl -i http://wwwdev.ebi.ac.uk/pride/proxi/archive/v0.1/proteins?resultType=compact

HTTP/1.1 501
Content-Type: application/json;charset=UTF-8
Date: Thu, 23 Apr 2020 04:25:31 GMT
Transfer-Encoding: chunked
Access-Control-Allow-Origin: *
Connection: close
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Access-Control-Allow-Headers, Authorization
X-Cache-Info: caching

{
"code" : 501,
"message" : "Not Implemented"
}

At MassIVE we have this:

$ curl -i http://ccms-internal.ucsd.edu/ProteoSAFe/proxi/v0.1/xxx
HTTP/1.1 404 Not Found
Date: Thu, 23 Apr 2020 04:27:27 GMT
Content-Type: text/html;charset=utf-8
Content-Length: 1030
Connection: close

<title>Apache Tomcat/6.0.24 - Error report</title><style></style>

HTTP Status 404 - /ProteoSAFe/proxi/v0.1/xxx


type Status report

message /ProteoSAFe/proxi/v0.1/xxx

description The requested resource (/ProteoSAFe/proxi/v0.1/xxx) is not available.


Apache Tomcat/6.0.24

(that's HTML that may not render well in a GutHub issue)

Even specifically asking for JSON doesn't seem to work:

$ curl -i --header "Accept: application/json" http://ccms-internal.ucsd.edu/ProteoSAFe/proxi/v0.1/xxx

HTTP/1.1 404 Not Found
Date: Thu, 23 Apr 2020 04:28:38 GMT
Content-Type: text/html;charset=utf-8
Content-Length: 1030
Connection: close

<title>Apache Tomcat/6.0.24 - Error report</title><style></style>

HTTP Status 404 - /ProteoSAFe/proxi/v0.1/xxx


type Status report

message /ProteoSAFe/proxi/v0.1/xxx

description The requested resource (/ProteoSAFe/proxi/v0.1/xxx) is not available.


Apache Tomcat/6.0.24

Seems like JSON should come back..
If asking for a unimplemented endpoint we get:

$ curl -i --header "Accept: application/json" http://ccms-internal.ucsd.edu/ProteoSAFe/proxi/v0.1/proteins?resultType=compact
HTTP/1.1 501 Not Implemented
Date: Thu, 23 Apr 2020 04:33:16 GMT
Set-Cookie: JSESSIONID=F75E68EB1B0AA0A0C601634E80677B6E; Path=/ProteoSAFe
Content-Type: text/html;charset=utf-8
Content-Length: 1292
Connection: close

<title>Apache Tomcat/6.0.24 - Error report</title><style></style>

HTTP Status 501 - Although this is an officially defined PROXI endpoint, it has not yet been implemented at this server


type Status report

message Although this is an officially defined PROXI endpoint, it has not yet been implemented at this server

description The server does not support the functionality needed to fulfill this request (Although this is an officially defined PROXI endpoint, it has not yet been implemented at this server).


Apache Tomcat/6.0.24

What's the best way?

I don't know. On the one hand it would be nice if all PROXI servers returned the same style for 400 and 404 and 500 and 501. On the other hand, Consistency among all errors for one server seems perhaps more useful. Too bad the different framework providers cannot even agree on the right way to do it.

I rather like the way things work at ProteomeCentral and PeptideAtlas, the HTTP status has the right number and is also named. And the JSON is simple and consistent and provides a nice English language description of what the problem is. But that's just the Python Flask way of doing it. I'm happy to change error codes that I have control over (400 a no data 404 and a 501), but I don't have control over the framework provided bad URL 404 and 500, etc. Well, that's probably not completely true, there are probably ways to override the default behavior.

Good fodder for discussion.

@ypriverol ypriverol added bug Something isn't working Implementation Issue related with one of the implementations labels Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Implementation Issue related with one of the implementations
Projects
None yet
Development

No branches or pull requests

3 participants