0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

better error message on bad encoding

This commit is contained in:
Eliot Horowitz 2010-11-28 03:35:44 -05:00
parent d4774cef29
commit 2016fe2e3d

View File

@ -202,8 +202,16 @@ namespace mongo {
// units, but experiments suggest 8bit units expected. We allocate // units, but experiments suggest 8bit units expected. We allocate
// enough memory that either will work. // enough memory that either will work.
if ( !JS_EncodeCharacters( _context , s , srclen , dst , &len) ) if ( !JS_EncodeCharacters( _context , s , srclen , dst , &len) ){
uasserted( 13498, str::stream() << "Not proper UTF-16: " << s); StringBuilder temp;
temp << "Not proper UTF-16: ";
for ( size_t i=0; i<srclen; i++ ){
if ( i > 0 )
temp << ",";
temp << s[i];
}
uasserted( 13498 , temp.str() );
}
string ss( dst , len ); string ss( dst , len );
free( dst ); free( dst );