move error handling to rflib