Skip to content

Commit 2d792ce

Browse files
committed
fixup! better error reporting from IntlMessage constructor
1 parent 0827b49 commit 2d792ce

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

ext/intl/msgformat/msgformat.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,12 @@ static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
8888
parse_error_str = intl_parse_error_to_string( &parse_error );
8989
spprintf( &msg, 0, "pattern syntax error (%s)", parse_error_str.s? ZSTR_VAL(parse_error_str.s) : "" );
9090
smart_str_free( &parse_error_str );
91+
9192
intl_error_set_code( NULL, INTL_DATA_ERROR_CODE( mfo ) );
93+
intl_errors_set_custom_msg( INTL_DATA_ERROR_P( mfo ), msg, 1 );
9294

93-
if( msg != NULL )
94-
{
95-
intl_errors_set_custom_msg( INTL_DATA_ERROR_P( mfo ), msg, 1 );
96-
efree( msg );
97-
return FAILURE;
98-
} else {
99-
intl_errors_set_custom_msg( INTL_DATA_ERROR_P( mfo ), "Unknown parser error", 0 );
100-
return FAILURE;
101-
}
95+
efree( msg );
96+
return FAILURE;
10297
}
10398

10499
INTL_CTOR_CHECK_STATUS(mfo, "msgfmt_create: message formatter creation failed");

0 commit comments

Comments
 (0)