test/synthesizer: rework the initialization logic to throw exceptions instead of returning -1 on errror