class TransactionCreator {

    public Transaction createTransactionThrowingException(CreateTransactionRequest request) {
        TransactionCreationData transaction = createTransaction(request);
        if (transaction.hasError()) {
            switch (transaction.getErrorType()) {
                case NOT_ENOUGH_APL:
                    throw new RestParameterException(ApiErrors.NOT_ENOUGH_FUNDS, "APL");
                case MISSING_DEADLINE:
                    throw new RestParameterException(ApiErrors.MISSING_PARAM, "deadline");
                case INCORRECT_DEADLINE:
                    throw new RestParameterException(ApiErrors.INCORRECT_PARAM_VALUE, "deadline");
                case INCORRECT_EC_BLOCK:
                    throw new RestParameterException(ApiErrors.INCORRECT_PARAM, "ecBlockId", "ecBlockId does not match the block id at ecBlockHeight");
                case VALIDATION_FAILED:
                    throw new RestParameterException(ApiErrors.TX_VALIDATION_FAILED, transaction.getError());
                case FEATURE_NOT_AVAILABLE:
                    throw new RestParameterException(ApiErrors.FEATURE_NOT_ENABLED);
                case MISSING_SECRET_PHRASE:
                    throw new RestParameterException(ApiErrors.MISSING_PARAM_LIST, "secretPhrase,passphrase");
                case INSUFFICIENT_BALANCE_ON_APPLY_UNCONFIRMED:
                    throw new RestParameterException(ApiErrors.TX_VALIDATION_FAILED, " not enough funds (APL,ASSET,CURRENCY)");
                default:
                    throw new RuntimeException("For " + transaction.getErrorType() + " no error throwing mappings was found");
            }
        }
        return transaction.getTx();
    }

    @Inject public  TransactionCreator(TransactionValidator validator, PropertiesHolder propertiesHolder, TimeService timeService, FeeCalculator feeCalculator, Blockchain blockchain, TransactionProcessor processor);

}