Adding concurrency control in our updateMovieHandler and documenting it.
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 57s
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 57s
This commit is contained in:
@@ -151,7 +151,12 @@ func (app *application) updateMovieHandler(w http.ResponseWriter, r *http.Reques
|
||||
// Pass the updated movie record to our new Update() method
|
||||
err = app.models.Movies.Update(movie)
|
||||
if err != nil {
|
||||
app.serverErrorResponse(w, r, err)
|
||||
switch {
|
||||
case errors.Is(err, data.ErrEditConflict):
|
||||
app.editConflictResponse(w, r)
|
||||
default:
|
||||
app.serverErrorResponse(w, r, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user