convert cocaine error codes to http codes, add logging