@@ -102,6 +102,7 @@ local ERRORS = {
102102 READ_TIMEOUT = 0x1200 ,
103103 READ_FAILURE = 0x1300 ,
104104 FUNCTION_FAILURE = 0x1400 ,
105+ WRITE_FAILURE = 0x1500 ,
105106 SYNTAX_ERROR = 0x2000 ,
106107 UNAUTHORIZED = 0x2100 ,
107108 INVALID = 0x2200 ,
@@ -122,6 +123,7 @@ local ERROR_TRANSLATIONS = {
122123 [ERRORS .READ_TIMEOUT ] = ' Read timeout' ,
123124 [ERRORS .READ_FAILURE ] = ' Read failure' ,
124125 [ERRORS .FUNCTION_FAILURE ] = ' Function failure' ,
126+ [ERRORS .WRITE_FAILURE ] = ' Write failure' ,
125127 [ERRORS .SYNTAX_ERROR ] = ' Syntax error' ,
126128 [ERRORS .UNAUTHORIZED ] = ' Unauthorized' ,
127129 [ERRORS .INVALID ] = ' Invalid' ,
@@ -1377,7 +1379,15 @@ do
13771379 elseif op_code == OP_CODES .ERROR then
13781380 local code = body :read_int ()
13791381 local message = body :read_string ()
1380- return nil , ' [' .. ERROR_TRANSLATIONS [code ].. ' ] ' .. message , code
1382+ local error_translation = ERROR_TRANSLATIONS [code ]
1383+
1384+ -- If the translation is not found, return a formatted string
1385+ -- with the error code for convenience.
1386+ if error_translation == nil then
1387+ error_translation = fmt (' UNSUPPORTED ERROR (code=0x%x)' , code )
1388+ end
1389+
1390+ return nil , ' [' .. error_translation .. ' ] ' .. message , code
13811391 elseif op_code == OP_CODES .READY then
13821392 return ready
13831393 elseif op_code == OP_CODES .AUTHENTICATE then
0 commit comments