
-------- Original Message -------- Subject: Re: Classifying engine errors Date: Mon, 21 Nov 2011 09:32:10 -0500 (EST) From: Jon Choate <jchoate@redhat.com> To: Michael Pasternak <mpastern@redhat.com> ----- Original Message -----
From: "Michael Pasternak" <mpastern@redhat.com> Sent: Monday, November 21, 2011 9:10:46 AM Subject: Classifying engine errors
Hi,
i would like to suggest classifying engine errors (VdcBllMessages) using these categories:
100-199. entity not found 200-300. missing parameters 300-399. no resources available 400-499. can't perform - user error 500-599. can't perform - server error 600-699. Unauthorized 700-x. Forbidden
this way rest api will be able mapping them to HTTP errors e.g any error returned by engine CAN_DO_ACTION 100 < x < 200 will be converted to HTTP 404 with CAN_DO_ACTION message detail
- this can be easily done by assigning id to each VdcBllMessages enum member in range of one of mentioned categories.
--
Michael Pasternak RedHat, ENG-Virtualization R&D
Wouldn't it make more sense for this mapping to happen within the REST API since that is the component that cares about HTTP codes? The engine core should be agnostic to any particular client to ensure its flexibility and separation of concern. -- Michael Pasternak RedHat, ENG-Virtualization R&D