Skip to content

Commit 6f22985

Browse files
committed
use error message from library
1 parent 12c30e4 commit 6f22985

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ext/enchant/enchant.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,8 @@ PHP_FUNCTION(enchant_broker_request_dict)
507507
dict->pdict =pdict;
508508
ZVAL_COPY(&dict->zbroker, broker);
509509
} else if (getThis()) {
510-
zend_throw_exception(spl_ce_RuntimeException, "Can't create a new EnchantDict", 0);
510+
const char *err = enchant_broker_get_error(pbroker->pbroker);
511+
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "%s", err ? err : "Can't create a new EnchantDict");
511512
} else {
512513
RETURN_FALSE;
513514
}
@@ -552,7 +553,8 @@ PHP_METHOD(EnchantDict, __construct)
552553
dict->pdict =pdict;
553554
ZVAL_COPY(&dict->zbroker, broker);
554555
} else {
555-
zend_throw_exception(spl_ce_RuntimeException, "Can't create a new EnchantDict", 0);
556+
const char *err = enchant_broker_get_error(pbroker->pbroker);
557+
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "%s", err ? err : "Can't create a new EnchantDict");
556558
}
557559
}
558560
/* }}} */
@@ -587,7 +589,8 @@ PHP_FUNCTION(enchant_broker_request_pwl_dict)
587589
dict->pdict = pdict;
588590
ZVAL_COPY(&dict->zbroker, broker);
589591
} else if (getThis()) {
590-
zend_throw_exception(spl_ce_RuntimeException, "Can't create a new EnchantDict", 0);
592+
const char *err = enchant_broker_get_error(pbroker->pbroker);
593+
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "%s", err ? err : "Can't create a new EnchantDict");
591594
} else {
592595
RETURN_FALSE;
593596
}

0 commit comments

Comments
 (0)