-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Incorrect response codes for invalid HTTP calls #1469
Comments
Also, it should be 404 , resource not found, when /model/{id} and id is a valid one but was not found in the DB. In any case I think if you try to map database operation errors with http status code will be a complicated task. For instance 404 - not found , 201 when you created a record and so on. As a client developer I might be must interested in the response message for regular DB operations. So if I sent an operation i would do: http.get<clientModel[]>(MyResourcreURL).suscribe( (result : clientModel) =>{} , error=>{} ); So I think that no matter the http satatus code, I would get to the error=> {} code right?, to show my users the appropriate message. Currently juggler is placing acceptable messages automatically for certain crud operations, the problem is that they are not being sent back to the client app thru the response object. So, talking in the database operation arena, the errors can vary a lot, and it would be a daunting task to try match everything to http status codes.
However, currently in our lb4 app, we are sending two properties that don not conflict with status or statusCode, to send in our custom operations an appropriate error code and message, but for CRUD operations I think it is ok, once the missing message is fixed :-) |
Thanks for the great feedback @marioestradarosa !! You are correct in that it should be a 404 and yes we definitely need to do some work around passing errors back from the DataBase as we head towards GA -- but I also think we should try and map some (not all) of the database errors to HTTP Status Codes because some users use that to display an error message in the front end since showing DB errors can be a bit confusing. |
@virkt25 this is more or less :-) DB Basic OperationsCreate
Read
Update
Delete
Notes
1- { Record } is the full record, and behaves similar to the current insert operation in that it returns the defined record in the model. |
Looks like it is fixed for |
Wonder if the fix happened because of the coercion and validation story. |
Almost certainly yes :) |
Description / Steps to reproduce / Feature proposal
From #1206
examples/todo
make a GET request to/todo/id
using API Explorer.id
shouldn't have a value (undefined
).id
. Same goes for an invalidid
value such as-10
,ten
, etc.Current Behavior
Expected Behavior
Acceptance Criteria
See Reporting Issues for more tips on writing good issues
The text was updated successfully, but these errors were encountered: