eduardoboucas / staticman

💪 User-generated content for Git-powered websites
https://staticman.net
MIT License
2.42k stars 541 forks source link

Respond with appropriate error codes, not 500 #218

Open nfreear opened 6 years ago

nfreear commented 6 years ago

Hi @eduardoboucas,

I'm loving Staticman - great job!

I notice that when the V2 api / server responds with an error that is the result of an incorrect request, missing / invalid staticman.yml or similar, it gives a 500 response.

5xx HTTP status codes are for server errors, which these are not ;).

Can I suggest that the server should respond with a 4xx status code, for example:

(See, https://github.com/nfreear/nfreear.github.io/issues/32.)

Thank you,

Nick


(Aha.

nfreear commented 6 years ago

Hi @eduardoboucas

I'd like to open a pull-request for this ... Ok?

(Btw, I've had a look at CONTRIBUTING.md - all OK for me!)

Thanks

Nick

eduardoboucas commented 6 years ago

@nfreear absolutely, go for it!

alexwaibel commented 4 years ago

I will 100% be reviewing this closely and hopefully merging this in once I get the server back in a running state. Thank you for submitting this.