Fixed log bug
Added exception when return code does not match the specified ones