if(result.isFailed() to if (scenario.isFailed() and added try-catch block to match webbit-websockets