error handling for get_message

It is for discussion, please do not merge it yet!