Added a codec for a message with status "error" and added call back function to handle the case when an error message is received